1. 项目对pom 文件的引入
```java
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${jasypt.version}</version>
</dependency>
```
配置
```java
jasypt:
encryptor:
password: uoj20@d03jd
```
2. 对数据的加密
```java
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
//加密所需的salt(盐)
textEncryptor.setPassword("uoj20@d03jd");
//要加密的数据(数据库的用户名或密码)
String username = textEncryptor.encrypt("root");
String password = textEncryptor.encrypt("myadmin);
System.out.println("username:"+username);
System.out.println("password:"+password);
```
3. 配置文件解密
使用解密如下 ENC(加密后的字符串')