Druid数据库密码加密

1、找到druid-version.jar目录imageimage

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

3、执行命令:java -cp druid-1.1.17.jar com.alibaba.druid.filter.config.ConfigTools 123456,得到密钥image

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

posted on 2019-11-08 22:20  为生而活  阅读(498)  评论(0编辑  收藏  举报

导航