chore: adopt ds-spring-user-framework 5.3.0 on Spring Boot 4.1.0 - #83
Merged
Conversation
Spring Boot 4.0.4 -> 4.1.0 brings Thymeleaf 3.1.2 -> 3.1.5, which evaluates
templates in a restricted expression context while the layout dialect decorates
the page and rejects SpEL bean access. Every
${@environment.getProperty('user.security.*')} and
${@environment.acceptsProfiles(...)} usage threw
TemplateProcessingException at render time.
- bump Spring Boot to 4.1.0 and ds-spring-user-framework to 5.3.0
- migrate templates to the framework's new ${userSecurity.*} view
(login/registration/forgot-password/update page URIs, loginActionURI,
copyrightFirstYear) across index, layout, header/footer fragments,
user register/login/registration-pending-verification/
request-new-verification-email, and event details
- add DemoTemplateModelAdvice exposing ${devOrLocalProfile} for the profile
check, which is not a user.security value
- update CustomUserEmailService super() for the 5.3.0 UserEmailService
constructor
Verified: ./gradlew clean test --refresh-dependencies (301 tests, 0 failures);
Playwright chromium 107 passed, chromium-mfa 1 passed.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the demo app to Spring Boot 4.1.0 and ds-spring-user-framework 5.3.0, addressing Thymeleaf 3.1.5 restricted-expression failures by removing ${@environment...} bean access from decorated templates.
Changes:
- Bump Spring Boot Gradle plugin to 4.1.0 and ds-spring-user-framework dependency to 5.3.0.
- Migrate affected Thymeleaf templates from
${@environment.getProperty(...)}/${@environment.acceptsProfiles(...)}to${userSecurity.*}and a new${devOrLocalProfile}model attribute. - Update
CustomUserEmailServiceconstructor call chain to match the framework’s updatedUserEmailServicesignature.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle | Upgrades Boot plugin and ds-spring-user-framework version. |
| src/main/java/com/digitalsanctuary/spring/demo/web/DemoTemplateModelAdvice.java | Adds a @ControllerAdvice model attribute for devOrLocalProfile to avoid restricted SpEL bean access. |
| src/main/java/com/digitalsanctuary/spring/demo/service/CustomUserEmailService.java | Updates super(...) call to pass new framework config dependency. |
| src/main/resources/templates/layout.html | Replaces @environment.acceptsProfiles(...) with ${devOrLocalProfile}. |
| src/main/resources/templates/index.html | Switches login/registration links to ${userSecurity.*} URIs. |
| src/main/resources/templates/fragments/header.html | Switches account/auth links to ${userSecurity.*} URIs. |
| src/main/resources/templates/fragments/footer.html | Switches copyright first-year source to ${userSecurity.copyrightFirstYear}. |
| src/main/resources/templates/user/login.html | Switches login action + auth links to ${userSecurity.*} URIs. |
| src/main/resources/templates/user/register.html | Switches message args + login link to ${userSecurity.*} URIs. |
| src/main/resources/templates/user/registration-pending-verification.html | Switches login link to ${userSecurity.loginPageUri}. |
| src/main/resources/templates/user/request-new-verification-email.html | Switches message args to ${userSecurity.*} URIs. |
| src/main/resources/templates/event/details.html | Switches login/registration links to ${userSecurity.*} URIs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts Spring Boot 4.1.0 and the released ds-spring-user-framework 5.3.0, and migrates the templates off the
${@environment...}idiom that Thymeleaf 3.1.5 rejects.Closes #82
Why
Boot
4.0.4 -> 4.1.0bundles Thymeleaf3.1.2 -> 3.1.5. Under 3.1.5, expressions using Spring bean access —${@environment.getProperty('user.security.*')}and${@environment.acceptsProfiles(...)}— are evaluated in a restricted expression context while thymeleaf-layout-dialect decorates the page, and throw:That broke rendering app-wide, with
SecurityConfigurationTestandMfaChallengeFlowIntegrationTestfailing on the render.What changed
build.gradle: Spring Boot4.0.4 -> 4.1.0,ds-spring-user-framework5.1.1 -> 5.3.0. The Boot BOM carries the bumps noted in Adopt Spring Boot 4.1.0: migrate ${@environment.getProperty(...)} template pattern for Thymeleaf 3.1.5 restricted expressions #82 (spring-security, hibernate-validator, thymeleaf-extras-springsecurity6, postgresql, lombok).${@environment.getProperty('user.security.*')}now reads from${userSecurity.*}, the secret-free view the framework exposes to templates as of 5.3.0 —loginPageUri,registrationUri,forgotPasswordUri,updateUserUri,loginActionUri,copyrightFirstYear. This covers the nine templates listed in the issue:index.html,layout.html,fragments/header.html,fragments/footer.html,user/register.html,user/login.html,user/registration-pending-verification.html,user/request-new-verification-email.html,event/details.html, including the usages nested inside#{message(...)}arguments inregister.htmlandrequest-new-verification-email.html.DemoTemplateModelAdvice(@ControllerAdvice+@ModelAttribute) exposing${devOrLocalProfile}for theacceptsProfiles('dev','local')check, which is not auser.securityvalue and so has no${userSecurity}equivalent.CustomUserEmailService:super(...)updated for the 5.3.0UserEmailServiceconstructor.No
${@environment...}usages remain in the templates.The issue's "framework relevance" note is addressed upstream: 5.3.0 ships
${userSecurity}as the supported replacement, so downstream apps have a documented migration target rather than each rolling their own@ControllerAdvice.Verification
./gradlew clean test --refresh-dependencies— 301 tests, 0 failures (refresh so the released 5.3.0 resolves from Maven Central, not a local snapshot).--project=chromium— 107 passed.--project=chromium-mfa— 1 passed.