Fix: Resolve Thymeleaf 3.1.4+ TemplateProcessingException in variables.css (Issue #5251)#5264
Open
EIHEI2 wants to merge 1 commit intocodecentric:masterfrom
Open
Fix: Resolve Thymeleaf 3.1.4+ TemplateProcessingException in variables.css (Issue #5251)#5264EIHEI2 wants to merge 1 commit intocodecentric:masterfrom
EIHEI2 wants to merge 1 commit intocodecentric:masterfrom
Conversation
…estriction - Add cssColors model attribute to UiController with pre-computed RGB values - Update variables.css template to use cssColors instead of @cssColorUtils bean reference - Add SpringStandardDialect bean configuration for compatibility This fixes the TemplateProcessingException caused by Thymeleaf 3.1.4.RELEASE which forbids bean references (@cssColorUtils) in CSS templates.
cdprete
reviewed
Apr 15, 2026
| @ModelAttribute(value = "cssColors", binding = false) | ||
| public Map<String, String> getCssColors() { | ||
| var palette = uiSettings.getTheme().getPalette(); | ||
| return Map.of( |
Contributor
There was a problem hiding this comment.
Given that the values here come from the configuration, I would personally just compute this map once in the constructor when the controller is created and just reuse that value every time the endpoint gets called.
That's just a small optimisation :)
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.
Description
This PR fixes the TemplateProcessingException that occurs with Thymeleaf 3.1.4.RELEASE when processing the variables.css template.
Problem
Thymeleaf 3.1.4+ introduced stricter security restrictions that forbid bean references (@cssColorUtils) in CSS templates, causing the following error:
Solution
Changes
Testing
The fix avoids bean references in the template while maintaining the same functionality. The RGB values are computed once per request in the controller instead of per-variable in the template.
Fixes #5251