可是HikariCP 默認沒有提供實現數據源加解密的方法html
JDK8的下載地址:java
curl localhost:4001/encrypt -d lengleng 密文
spring: datasource: password: '{ciper}密文' xxx: '{ciper}密文'
<dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>1.16</version> </dependency>
jasypt: encryptor: password: foo #根密碼
@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = PigAdminApplication.class) public class PigAdminApplicationTest { @Autowired private StringEncryptor stringEncryptor; @Test public void testEnvironmentProperties() { System.out.println(stringEncryptor.encrypt("lengleng")); } }
spring: datasource: password: ENC(密文) xxx: ENC(密文)
其餘非對稱等高級配置參考git
Key | Required | |
jasypt.encryptor.password | True | 根密碼 |
jasypt.encryptor.algorithm | False | PBEWithMD5AndDES |
jasypt.encryptor.keyObtentionIterations | False | 1000 |
jasypt.encryptor.poolSize | False | 1 |
jasypt.encryptor.providerName | False | SunJCE |
jasypt.encryptor.saltGeneratorClassname | False | org.jasypt.salt.RandomSaltGenerator |
jasypt.encryptor.stringOutputType | False | base64 |
jasypt.encryptor.proxyPropertySources | False | false |