jasypt加密启动时报错问题
jasypt版本:3.0.3
报错:
Failed to bind properties under 'xxx' to java.lang.String:
Reason: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'xxx' to java.lang.String
Action:
Update your application's configuration
解决办法一(亲测有效):
降低版本,降低为2.1.x
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
解决办法二
官方描述是,在3.0后默认支持的算法为PBEWITHHMACSHA512ANDAES_256 ,该种加密方式由sha512 加 AES 高级加密组成。
需要JCE(Java Cryptography Extension无限强度权限策略文件)支持.
- 要么升级jdk到jdk1.8.0_161,正常启动
- 要么,那既然默认算法需要JCE支持,就在配置文件中更改加密算法
jasypt.encryptor.algorithm=PBEWithMD5AndDES
启动正常