【问题标题】:Cache Busting in Spring Boot + Thymeleaf applicationSpring Boot + Thymeleaf 应用程序中的缓存破坏
【发布时间】:2016-11-23 11:47:32
【问题描述】:

我阅读了 spring boot documentation 并且似乎如果我使用 Thymeleaf,我可以将以下内容添加到我的 application.properties 文件中以实现缓存清除:

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

但它不起作用!

这是我看到的错误:

原因:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:私有 org.springframework.boot.autoconfigure.web.ResourceProperties org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.resourceProperties;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“spring.resources.CONFIGURATION_PROPERTIES”的 bean 时出错:无法将属性绑定到 [unknown](target=spring.resources,ignoreInvalidFields=false,ignoreUnknownFields=false,ignoreNestedProperties =假);嵌套异常是 org.springframework.beans.NotWritablePropertyException:bean 类 [org.springframework.boot.autoconfigure.web.ResourceProperties] 的无效属性 'chain[strategy][fixed][version]':无法访问引用的属性中的索引值索引属性路径 'chain[strategy][fixed][version]';嵌套异常是 org.springframework.beans.NotReadablePropertyException:bean 类 [org.springframework.boot.autoconfigure.web.ResourceProperties] 的无效属性 'chain[strategy][fixed][version]':Bean 属性'chain[strategy][ fixed][version]' 不可读或有无效的getter方法:getter的返回类型是否与setter的参数类型匹配?

我错过了什么?

【问题讨论】:

  • 你能把剩下的代码加在这里吗?
  • @ChathurangaTennakoon 我没有在代码中添加任何配置。我让 Spring Boot 为我处理。

标签: spring-boot thymeleaf


【解决方案1】:

问题出在我使用的 Spring Boot 版本上。 Spring Boot 1.2 没有任何此类属性,而 1.3 则有。

【讨论】:

    最近更新 更多