1. 添加依赖
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
2. 设置加密盐值为(密码)
123456
4. yml文件增加jasypt配置(3.0以后版本需要修改默认加密算法)
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
3. 开发环境设置idea启动参数(不然会报错failed to bind properties under '********' to java.lang.String)
-Djasypt.encryptor.password=123456
4. 生成环境启动
java -jar -Djasypt.encryptor.password=123456 *****.jar