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(密文)