Repository navigation
chore(deps): Spring Boot 4.2.0, fix EnvironmentPostProcessor registration - #402
Conversation
Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 4.1.2 to 4.2.0. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](spring-projects/spring-boot@v4.1.2...v4.2.0) --- updated-dependencies: - dependency-name: org.springframework.boot dependency-version: 4.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…g Boot 4.2 Spring Boot 4.2 removes the deprecated org.springframework.boot.env.EnvironmentPostProcessor interface, which broke compilation. Switch MessageSourceEnvironmentPostProcessor to org.springframework.boot.EnvironmentPostProcessor (available since Boot 4.0). Also move its registration from META-INF/spring/...EnvironmentPostProcessor.imports to META-INF/spring.factories. Spring Boot only discovers environment post-processors through spring.factories, so since 5.0.0 the post-processor never ran and the library message bundle was not added to spring.messages.basename. Add a test that runs a real SpringApplication to cover the registration.
…gration guide, README
ReviewOverall this looks good: a focused fix with good verification. What I checked
Suggestions (non-blocking)
No security or performance concerns. Approving in spirit; the CI result on Boot 4.2.0 is the main gate. |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are limited and focused on Spring Boot 4.2 compatibility and proper EnvironmentPostProcessor discovery, with explicit registration via spring.factories and a SpringApplication-based test plus documentation updates providing supporting evidence and no outstanding issues noted.
No open issues 🎉
What changed in this PR
Updates the project for Spring Boot 4.2.0 compatibility and fixes environment post-processor discovery so the library’s message bundle is appended to spring.messages.basename at runtime.
Changes:
- Bump the Spring Boot Gradle plugin to 4.2.0 and update
MessageSourceEnvironmentPostProcessorto implementorg.springframework.boot.EnvironmentPostProcessor. - Register the environment post-processor via
META-INF/spring.factoriesso Spring Boot discovers and runs it. - Add a
SpringApplication-based test to verify real Boot discovery and merged basename behavior, and update README/MIGRATION/CHANGELOG for Boot 4.2 support and the registration fix.
| File | Description |
|---|---|
| src/test/java/com/digitalsanctuary/spring/user/MessageSourceEnvironmentPostProcessorTest.java | Adds a SpringApplication-based test to confirm the environment post-processor is discovered via spring.factories and merges spring.messages.basename correctly. |
| src/main/resources/META-INF/spring.factories | Registers MessageSourceEnvironmentPostProcessor under org.springframework.boot.EnvironmentPostProcessor for Spring Boot runtime discovery. |
| src/main/java/com/digitalsanctuary/spring/user/MessageSourceEnvironmentPostProcessor.java | Updates the post-processor to use the non-deprecated Boot 4.x EnvironmentPostProcessor interface while preserving basename merge behavior and ordering. |
| README.md | Updates documented compatibility to include Spring Boot 4.2.x and adjusts related wording. |
| MIGRATION.md | Documents the historical environment post-processor registration issue and the fix, and updates the compatibility matrix/details for Boot 4.2. |
| CHANGELOG.md | Notes the Boot 4.2 upgrade and the environment post-processor registration/message bundle fix under Unreleased. |
| build.gradle | Bumps the Spring Boot Gradle plugin version to 4.2.0. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
… config; document spring.factories location
|
Review follow-up in aad10a5:
|
ReviewOverall this is a solid, well-scoped PR. The root-cause analysis is convincing: Good
Suggestions / risks
No security or performance concerns. Once the 4.0.x loading question is confirmed, this looks good to merge. 🤖 Generated with Claude Code |
Supersedes #400 (Dependabot bump from Spring Boot 4.1.2 to 4.2.0), which fails to compile.
Why #400 fails
Spring Boot 4.2 removes the deprecated
org.springframework.boot.env.EnvironmentPostProcessor.MessageSourceEnvironmentPostProcessorimplemented it, socompileJavafails. It now implementsorg.springframework.boot.EnvironmentPostProcessor, which has existed since Boot 4.0.Bug fixed along the way (present since 5.0.0)
The post-processor was registered in
META-INF/spring/org.springframework.boot.env.EnvironmentPostProcessor.imports. Spring Boot only discovers environment post-processors throughMETA-INF/spring.factories, so it never ran. Running a realSpringApplicationon main (Boot 4.1.2) confirmed that the library bundle was never appended tospring.messages.basename. Java callers hid this with English fallbacks, but templates with no fallback (the passkey-registered email) rendered??key??.Changes
MessageSourceEnvironmentPostProcessor: switches to the new interface..importsfile toMETA-INF/spring.factories.MessageSourceEnvironmentPostProcessorTest: adds a test that boots a realSpringApplicationand checks the merged basename. The existing tests callmergeBasename()directly, so they could not catch a registration Spring Boot never loads.[Unreleased], MIGRATION.md (compatibility matrix and a note in the 5.0 message bundle section), and the README compatibility text now cover Boot 4.2.Verification
./gradlew buildon Boot 4.2.0: 1,286 tests, 0 failures.-Xlint:deprecation: no new deprecation warnings compared with main, apart from the one this change removes.docs/RELEASE-TESTING.md) against 5.4.2-SNAPSHOT:clean test(demo on Boot 4.1.1): 312 tests, 0 failures (182 skipped, same as the 5.4.1 baseline).chromium: 107 passed, 0 failed.chromium-mfa: 1 passed, 0 failed.