spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.58k stars 40.55k forks source link

Actuator health for DB doesn't work when using JSYPT encrypted password in application.properties #12373

Closed amitommishra closed 6 years ago

amitommishra commented 6 years ago
amitommishra commented 6 years ago

Build.gradle using com.github.ulisesbocchio:jasypt-spring-boot-starter

in Application.properties: spring.datasource.password=ENC(encrypted_password)

when calling actuator health it is not working. It works when i use non encrypted password.

Looks like actuator is not taking care of decryption when Jsypt is used.

wilkinsona commented 6 years ago

Please read the documentation for jasypt-spring-boot. You cannot place an encrypted property in application.properties.

amitommishra commented 6 years ago

reference: http://www.jasypt.org/encrypting-configuration.html https://stackoverflow.com/a/23859824/544918

Can you please help me understand it why we cannot use as i see it mentioned same way in jsypt site

Example: datasource.driver=com.mysql.jdbc.Driver datasource.url=jdbc:mysql://localhost/reportsdb datasource.username=reportsUser datasource.password=ENC(G6N718UuyPE5bHyWKyuLQSm02auQPUtm)

wilkinsona commented 6 years ago

The documentation that I linked to above describes how to use jasypt-spring-boot. I've never used it before so I can only recommend that you read the documentation and use one of the two approaches that it describes (@EnableEncryptableProperties or customization of your application's Environment).