Druid数据库密码加密

时间:2022-04-11 23:40:31

1、找到druid-version.jar目录Druid数据库密码加密Druid数据库密码加密

2、cmd执行命令:cd到jar包目录下

3、执行命令:java -cp druid-1.1.17.jar com.alibaba.druid.filter.config.ConfigTools 123456,得到密钥Druid数据库密码加密

4、在application.properties中配置:

spring.datasource.password=idOgPR4XQBOdVM59bDupheVnkjsL1ZTr6JJ0KC KlnJh2SFWkYsdq2MuyHdsBaskN5014w5Wmjm65ZHg2LIPQw==
spring.datasource.publicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANBvCbHmADoJKn9XsiPGnXWQatLxJXXAsgr1zQtaeE36/uVhacG1DbOb1TRCe tfdHVlv/NfnWv5kADEGItRW5sCAwEAAQ==
# 启用加密,配置公钥。
spring.datasource.druid.connection-properties=config.decrypt=true;config.decrypt.key=${spring.datasource.publicKey}
# 启用ConfigFilter
spring.datasource.druid.filter.config.enabled=true