Description
Original issue here: thymeleaf/thymeleaf-spring#227
It seems like cache-busting does not work when lazy initialization is active. Once I set it to false cache-busting works again.
This seems like a bug for the docs say:
In a web application, enabling lazy initialization will result in many web-related beans not being initialized until an HTTP request is received.
But this does not seem to be true for whatever component is responsible for spring.resources.chain.strategy.content
.
Spring boot versions tested: 2.2.2 and 2.2.6
Tested with Thymeleaf
Miminal setup:
Check out https://github.com/ultraq/gs-serving-web-content/tree/cache-busting-issue/complete (branch cache-busting-issue).
In application.properties
:
spring.resources.cache.cachecontrol.max-age=604800
spring.resources.chain.enabled=true
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
spring.resources.chain.html-application-cache=true
# toggle this on/off
#spring.main.lazy-initialization=true
Maybe this behaviour is intended / to be expected - if so please add a paragraph to the docs.