Skip to content

Content strategy does not work with Thymeleaf and WelcomePageHandlerMapping #16309

@filiphr

Description

@filiphr

When the WelcomePageHandlerMapping is used to resolve the index.html from Thymeleaf and spring.resources.chain.strategy.content.enabled=true is set then the resolving of the th:src and th:href does not work as expected. The reason for that is that the ResourceUrlEncodingRequestWrapper does not have the ResourceUrlProvider set. The reason for it not having set is that ResourceUrlProviderExposingInterceptor is not in the WelcomePageHandlerMapping.

If I add a @Controller that maps on / then everything works as expected.

I've created a reproducal repository (https://github.com/filiphr/spring-boot-thymeleaf-content-strategy-problem) that displays this problem.

I've spent quite some time debugging this, trying to understand why it isn't working. Let me know if I can provide more information.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions