spring-boot项目启动中遇到Invalid property 'rememberme[key]' of bean class

今天在工作流平台搭建继承spring-boot时遇到了以下问题:

Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'rememberme[key]' of bean class [org.springframework.boot.autoconfigure.security.SecurityProperties]: Bean property 'rememberme[key]' 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.getPropertyValue(BeanWrapperImpl.java:731)
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:948)
	... 113 more

首先我们看这个报错的异常类,NotReadablePropertyException:不可读属性异常。

Invalid property 'rememberme[key]' of bean class [org.springframework.boot.autoconfigure.security.SecurityProperties]: Bean property 'rememberme[key]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

bean类[org.springframework.boot.autoconfigure.security.securityproperties]的属性“rememberme[key]”无效:bean属性“rememberme[key]”不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配?

解决办法如下:

首先打开 activiti-app 下src中的META-INF/activiti-app/activiti-app.properties文件:

看到开头有这段代码:

我们就知道错误的原因了,spring-boot对应的security提供了rememberme设置,刚好和这里重叠。而activiti-app.properties中的security.rememberme.key=testkey  会认为把rememberme的key属性设置为testkey 。但是对于spring-boot提供的这个rememberme是不可读不可写的,所以导致这个问题

知道了问题的原因再来解决就简单了,只需要将这段代码再加个前缀,解决了冲突就可以了:

这里我将此文件的所有 security.rememberme.key 跟换成 appconf.security.rememberme.key。

再次执行就不会报这个错误了。

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青山孤客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值