版权声明:一家之言,看完就忘了吧 https://blog.csdn.net/leisure_life/article/details/82781300
jasypt加密yml配置项
jdk:1.8
pom:
<!-- https://mvnrepository.com/artifact/com.github.ulisesbocchio/jasypt-spring-boot-starter -->
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>1.16</version>
</dependency>
yml配置加解密串
获取加密密码
@Autowired
StringEncryptor stringEncryptor;
@Test
public void encryptPwd() {
String pw = stringEncryptor.encrypt("yourpasswd");
String us = stringEncryptor.encrypt("yourusername");
System.out.println(pw);
System.out.println(us);
}
这里原来是明文密码和明文用户名
测试连接
@Test
public void testDBConn(){
System.out.println(Driver.class);
}