Bootstrap

java链接数据库jasypt加密

配置文件

jasypt:
  encryptor:
    password: uoj20@d03jd

ppm文件

<dependency>
		<groupId>com.github.ulisesbocchio</groupId>
		<artifactId>jasypt-spring-boot-starter</artifactId>
		<version>2.1.0</version>
	</dependency>

java代码

 public static void main(String[] args) {
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //加密所需的salt(盐)
        textEncryptor.setPassword("uoj20@d03jd");
        //要加密的数据(数据库的用户名或密码)
        String username = textEncryptor.encrypt("SYSDBA");
        String password = textEncryptor.encrypt("SYSDBA");
        System.out.println("username:" + username);
        System.out.println("password:" + password);
    }

数据库链接配置

username: ENC(YBAe8er2Bx6408OsHW8Hrw==)
password: ENC(dAgcl967wxLGCVtQ456MTQ==)