在Spring Boot + Thymeleaf应用程序中缓存Busting

时间:2016-07-20 09:50:49

标签: spring-boot thymeleaf

我读了春季启动documentation,似乎如果我使用的是Thymeleaf,我可以将以下内容添加到我的application.properties文件中以实现缓存清除:

spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**

但它不起作用!

这是我看到的错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ResourceProperties org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.resourceProperties; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.resources.CONFIGURATION_PROPERTIES': Could not bind properties to [unknown] (target=spring.resources, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'chain[strategy][fixed][version]' of bean class [org.springframework.boot.autoconfigure.web.ResourceProperties]: Cannot access indexed value in property referenced in indexed property path 'chain[strategy][fixed][version]'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'chain[strategy][fixed][version]' of bean class [org.springframework.boot.autoconfigure.web.ResourceProperties]: Bean property 'chain[strategy][fixed][version]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

我错过了什么?

1 个答案:

答案 0 :(得分:4)

问题在于我使用的弹簧启动版本。 Spring引用1.2在1.3版本中没有任何此类属性。