1、找到druid-version.jar目录
2、cmd执行命令:cd到jar包目录下
3、执行命令:java -cp druid-1.1.17.jar com.alibaba.druid.filter.config.ConfigTools 123456,得到密钥
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}# 启用ConfigFilterspring.datasource.druid.filter.config.enabled=true
原文地址:https://www.cnblogs.com/lived/p/11823642.html
时间: 2024-10-09 16:37:23