一、找到對應的druid的位置(查看Maven依賴的JAR)java
二、運行命令獲取加密後的密碼(記住先切換到你的JAR目錄)git
java -cp druid-1.0.16.jar com.alibaba.druid.filter.config.ConfigTools you_password
三、獲得publicKey和passwordgithub
jdbc.password=ARyf9XCgVBzhRyFLhcRpMgWOR6AbIKkSUxnA2ScluDwVhQEZ2vnspH7ZIUvKuuP9Z7WOGJPQTIAO/irO55c/Iw==spring
jdbc.publicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIhHirzTdNoQb+JrV+CkpJOJYVTnRktiR4EbKN6CruF2mMlRBy3NM/5xlb5FR+hsRxadpzzDs8xJXl8LxTnRA7sCAwEAAQ==app
四、spring-applicationContext.xml文件配置數據源ui
<property name="filters" value="config" />加密
<property name="connectionProperties" value="config.decrypt=true;config.decrypt.key=${jdbc.publicKey}" />spa