New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devtools customization breaks Web MVC resource config #24416
Comments
I think this may be a duplicate of #24203. |
I thought the same Andy but this test is failing for me with |
Courtesy of @wilkinsona for reminding me. With @chrisrhut please give your actual project a try with |
Thank you very much for the quick response, @wilkinsona and @snicoll - I confirmed |
Thank you very much for checking @chrisrhut. |
There are two ways to configure Spring MVC resources - via the
spring.web.resources
configuration, and the deprecatedspring.resources
configuration.With spring-boot 2.4.0, there is a bug where if Devtools is enabled,
spring.web.resources
is ignored and the deprecated configuration is read instead.The WebMvcAutoConfiguration ostensibly only chooses the deprecated configuration if it's been customized, and falls back to the WebProperties Resources. However, one of Devtools' customizations (disabling
spring.resources.chain.cache
) sets the "has been customized" flag and thus switches configurations out from under you.I noticed this because static resources started 404'ing with Devtools enabled, but worked fine without. Switching to the deprecated configuration fixes the issue, but is clearly an undesirable solution.
This can be observed in the following test case. Note that Devtools turns itself off in tests and this can't be bypassed, but setting the
spring.resources.chain.cache=false
simulates its modification.The text was updated successfully, but these errors were encountered: