问题概述
最近升级了一次密码加密的插件从2.x->3.x的升级,启动项目时SpringBoot报错如下
1 2 3 4 5 6 7 8 9
| Description:
Failed to bind properties under 'spring.datasource.password' to java.lang.String:
Reason: Failed to bind properties under 'spring.datasource.password' to java.lang.String
Action:
Update your application's configuration
|
原Pom版本
1 2 3 4 5
| <dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>2.0.0</version> </dependency>
|
升级后pom
1 2 3 4 5
| <dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>3.0.2</version> </dependency>
|
接下来网上寻找解决方案,从官方git发现issue
Failed to bind properties under ‘spring.datasource.password’ to java.lang.String 在此comment处发现解决方案
原yml配置文件
1 2 3
| jasypt: encryptor: password: 123456
|
更改为
1 2 3 4 5
| jasypt: encryptor: password: 123456 algorithm: PBEWithMD5AndDES iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
重启项目,项目正常启动。如果还有别的方法可以解决可以留言哦