最新的Spring Boot升级是从SecurityProperties中抛出无效属性' text [encryption]

时间:2014-12-28 04:53:24

标签: java spring spring-boot

我将spring boot升级到最新版本1.2.0.RELEASE,现在最终出现以下异常。

used by: org.springframework.beans.NotWritablePropertyException: Invalid property 'text[encryption]' of bean class [org.springframework.boot.autoconfigure.security.SecurityProperties]: Cannot access indexed value in property referenced in indexed property path 'text[encryption]'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'text[encryption]' of bean class [org.springframework.boot.autoconfigure.security.SecurityProperties]: Bean property 'text[encryption]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:950)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:926)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:749)
at org.springframework.validation.DataBinder.doBind(DataBinder.java:645)
at org.springframework.boot.bind.RelaxedDataBinder.doBind(RelaxedDataBinder.java:119)
at org.springframework.validation.DataBinder.bind(DataBinder.java:630)
at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:251)
at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:225)
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:296)

使用的其他依赖项:

<spring.version>4.1.3.RELEASE</spring.version>
<spring-security.version>3.2.5.RELEASE</spring-security.version>
<spring-data.version>1.4.1.RELEASE</spring-data.version>

任何想法可能是什么原因。谢谢你的帮助

1 个答案:

答案 0 :(得分:5)

我觉得你的application.properties或application.yml中有以下属性:

security.text.encryption

你不应该有任何从'security'开始的自定义属性,因为spring-boot会尝试将它映射到SecurityProperties。

SecurityProperties配置:

@ConfigurationProperties(prefix = "security", ignoreUnknownFields = false)

意味着它将在从'security'

开始的任何未知属性上失败