参考认识BeanFactoryPostProcessor和BeanDefinitionRegistryPostProcessor - 知乎
SpringBoot 之 Jasypt 实现yml配置文件加密_-djasypt.encryptor.password-优快云博客
【springboot】jasypt加密_jasypt.encryptor.password-优快云博客
实现:
导包:
使用说明参考GitHub - ulisesbocchio/jasypt-spring-boot: Jasypt integration for Spring boot
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.4</version>
</dependency>
生成加密后的配置value:
public class EncryptionUtil {
//https://blog.youkuaiyun.com/qq_41055045/article/details/126740841
public static void main(String[] args) {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
// 加密方式
config.setAlgorithm("