1、测试网上博文3.0.4版本
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.4</version>
</dependency>
并且yml文件配置
jasypt:
encryptor:
password: qwert12345
# iv-generator-classname: org.jasypt.iv.NoIvGenerator
iv-generator-classname: org.jasypt.iv.RandomIvGenerator
algorithm: PBEWithMD5AndDES
依然报错:Failed to bind properties under 'spring.datasource.password' to java;
然后按照网上所说降低Jasypt版本到2.0.2
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>
重新配置yml文件
jasypt:
encryptor:
password: qwert12345
algorithm: PBEWithMD5AndDES
依然报错 :Failed to bind properties under 'spring.datasource.password' to java
很是头疼,最后发现这里需要更改ENC(password)改为DEC(password)重新不再报错。