Skip to content

fix(#5251): expose the colors configured in the settings directly rather then calling a method which is not allowed from Thymeleaf 3.1.4#5285

Merged
SteKoe merged 3 commits intocodecentric:masterfrom
cdprete:fix/5251
Apr 20, 2026
Merged

fix(#5251): expose the colors configured in the settings directly rather then calling a method which is not allowed from Thymeleaf 3.1.4#5285
SteKoe merged 3 commits intocodecentric:masterfrom
cdprete:fix/5251

Conversation

@cdprete
Copy link
Copy Markdown
Contributor

@cdprete cdprete commented Apr 20, 2026

Takeover of #5264.
Fixes #5251.
Tested locally with the servlet & reactive samples with the profiles dev,insecure,themed active (themed config copied from the servlet example into the reactive for this reason).

@SteKoe some of the tests actually fail on Windows, but they do fail also with the master branch, so I assume it's safe.

@SteKoe
Copy link
Copy Markdown
Contributor

SteKoe commented Apr 20, 2026

Looks good except that CssColorUtils can be a static Utility class and do not need to be injected (just like PathUtils). I have pushed a change for that.

…her then calling a method which is not allowed from Thymeleaf 3.1.4
@cdprete
Copy link
Copy Markdown
Contributor Author

cdprete commented Apr 20, 2026

Looks good except that CssColorUtils can be a static Utility class and do not need to be injected (just like PathUtils). I have pushed a change for that.

I realized that, but I didn't want to change it without knowing why you guys made it as a bean in the first place.
For example, to mock it easily with @MockitoBean or so.

By the way, the build is broken now with your change 😅
Can you please fix it?

@cdprete
Copy link
Copy Markdown
Contributor Author

cdprete commented Apr 20, 2026

@SteKoe what do you think about the idea of adding some tests to verify that the colors are properly populated both for the controller method and the CSS file?

I know the current implementation is quite trivial and it's maybe even an overkill to test it, but having them could potentially avoid bugs in the future due to refactoring.

For example: pass twice the same grade value in the controller for different colors or use a non matching name in the CSS file.

@cdprete
Copy link
Copy Markdown
Contributor Author

cdprete commented Apr 20, 2026

@SteKoe I was about to add the tests but you've been faster 🙂

@SteKoe
Copy link
Copy Markdown
Contributor

SteKoe commented Apr 20, 2026

@SteKoe I was about to add the tests but you've been faster 🙂

sorry! :D

@cdprete
Copy link
Copy Markdown
Contributor Author

cdprete commented Apr 20, 2026

@SteKoe I was about to add the tests but you've been faster 🙂

sorry! :D

No worries 👍

Your implementation is actually better than the one I was thinking about ;)

@SteKoe SteKoe merged commit 164f6bc into codecentric:master Apr 20, 2026
1 check passed
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.

org.thymeleaf.exceptions.TemplateProcessingException in variables.css

2 participants