Skip to content

Support for Spring without Spring Boot#306

Open
pvdbosch wants to merge 32 commits intomainfrom
feature/spring-without-boot
Open

Support for Spring without Spring Boot#306
pvdbosch wants to merge 32 commits intomainfrom
feature/spring-without-boot

Conversation

@pvdbosch
Copy link
Contributor

@pvdbosch pvdbosch commented Feb 24, 2026

Lots of refactoring to enable support for Spring without Spring Boot dependencies.

  • remove scanning (ComponentScan), use explicit @Configuration (application contexts) instead
  • module structure changes:
    • a "-spring" module that can be used without SB. Only the parts that are needed can be imported
      • it includes support for both Jackson2 and Jackson3 alongside each other; allowing to delete the "-core" modules
    • added "-starter" to the name of the modules with autoconfiguration active, these have SB dependencies (except the "-spring-boot-3" one for backwards compatibility)
  • renamed packages to add ".server" and ".client" where applicable
  • avoid exposing abstract classes to Spring users:
    • add WebClientFilter extracting PROBLEM_FILTER from AbstractProblemWebClientCustomizer
    • add an interface ProblemResponseErrorHandler
  • add an annotation @EnableProblemModule(beanValidation=true, swaggerRequestValidation=false, ...) to enable easy activation in non SB-environment

Other:

  • NoResourceFoundExceptionHandler merged into RoutingExceptionHandler (the split was bc NoResourceFoundException was new in SBv3)
  • changed packages of spring integration tests to add ".it" to avoid interference of their own component scanning with the rest-problem packages
  • for configuration, changed to @Value instead of @ConfigurationProperties to cut dependency to spring boot

TODO:

  • review by others
  • update documentation
  • investigate issue: using EnableProblemModule intellij shows issues that beans aren't found, while tests doe work
  • add integration tests for server/client usage w/o starters

- create autoconfiguration for each client or server module, without componentscan
- move integration tests to a subpackage to avoid autowiring problems with the problem modules
- add missing @bean annotations
- move error and exception handlers to common spring module
@pvdbosch pvdbosch marked this pull request as draft February 24, 2026 10:17
@pvdbosch
Copy link
Contributor Author

@jpraet , could you review if the changes in the PR look good to you high-level?

I've tested it locally in a Spring (non-Boot) project using the @EnableProblemModule annotation.
If OK, we'll continue work on the remaining TODOs after which a more detailed review can be done.

@jpraet
Copy link
Contributor

jpraet commented Feb 25, 2026

@jpraet , could you review if the changes in the PR look good to you high-level?

Looks good to me high-level. Thank you

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Mar 3, 2026

The PR is now ready for review.

I made following changes, on top of the previous ones:

  • added an integration test for spring-only.
    • It uses spring boot to provide an application server, but with minimal starters/autoconfiguration.
    • RestTemplate isn't tested because needs invasive test refactoring and it's is on its way out anyway in Spring 8
  • updated documentation
  • modified how the belgif-rest-problem-it-common-jakarta module is generated (transform source instead of jar) to make it easier to debug integration tests
  • remove abstract classes for customizers in spring module, bc they're spring-boot-specific functionality and have very little code

@pvdbosch pvdbosch marked this pull request as ready for review March 3, 2026 12:57
jpraet added a commit that referenced this pull request Mar 16, 2026
Extracted from #306 and
generalized to the other jakarta modules.

This improves the user experience from within the IDE (building,
testing, debugging, ...).
# Conflicts:
#	belgif-rest-problem-it/belgif-rest-problem-it-common-jakarta/pom.xml
jpraet added a commit that referenced this pull request Mar 16, 2026
jpraet added a commit that referenced this pull request Mar 16, 2026
@jpraet jpraet requested a review from a team March 18, 2026 10:53
====
*Breaking changes:*

* Users of `belgif-rest-problem-spring-boot-4` from version should now depend on the `belgif-rest-problem-spring-boot-4-starter` module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from version

belgif-rest-problem-spring-boot-4 was renamed to belgif-rest-problem-spring-boot-4-starter,
while belgif-rest-problem-spring-boot-3 remains.

I guess because the spring-boot-3 module has been around for longer so the user impact is higher.

But maybe we can still do the rename, while also keeping the belgif-rest-problem-spring-boot-3 around for a while as deprecated (it would be empty and depend on belgif-rest-problem-spring-boot-3-starter).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, or we could set a relocation pom for the old artifact. I'll test if that would work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relocation pom works, I've add this in a new commit.
For maven builds this works as expected; recent Renovate versions suggests the rename as well.
Only dependabot might not detect the new version (see dependabot/dependabot-core#1947 )

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants