我收到以下错误:
...
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'trustStore' of bean class [it.gvb.arch.connector.http.HttpClientBuilderFactory]: Bean property 'trustStore' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1076) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:927) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1510) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
我需要在我的应用程序上下文中加载一个信任库,我正在尝试与 Spring Documentation 中解释的方式相同的方式。 ,所以我这样配置我的bean:
<bean id="secTrustStore" class="org.springframework.ws.soap.security.support.KeyStoreFactoryBean">
<property name="password" value="${http.truststore.password:#{null}}"/>
<property name="location" value="${http.truststore.location:#{null}}"/>
<property name="type" value="${http.truststore.type:pkcs12}"/>
</bean>
对我做错了什么有什么建议吗?
最佳答案
问题不是Spring的KeyStoreFactoryBean
,问题是你的 HttpClientBuilderFactory
类没有trustStore
属性或缺少 setter 。仔细检查类(class)。
关于java - Bean 属性 'trustStore' 不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型是否匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40970659/