2016-07-20 14 views
2

我讀春天開機documentation,似乎如果我使用Thymeleaf,我可以再補充以下我application.properties文件來實現緩存無效:緩存在春季啓動+ Thymeleaf應用猛擊

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?

我缺少什麼?

+0

你可以在這裏添加剩餘的代碼嗎? –

+0

@ChathurangaTennakoon我還沒有在代碼中添加任何配置。我讓Spring Boot爲我處理它。 –

回答

4

問題在於我使用的彈簧引導版本。在1.3版本中,Spring Boot 1.2沒有任何這樣的屬性。