We upgraded Spring Boot version to 2.7.7 from 2.1.x. When we use
spring.datasource.password=${datasource_password:ENC(xxxxxxxxxxxxxxxx)}, it fails to get a DB connection.
However, with clear text in password, it works.
I did some search on the web and tried most of the suggestions as below:
- Upgrading/downgrading the Maven dependency jasypt-spring-boot-starter version 3.x,2.0.0
- Passing
-Djasypt.encryptor.password=or-DJASYPT_ENCRYPTOR_PASSWORD=as JVM argument - Setting
spring.datasource.password=ENC(encrypted_password) - I have also tried setting the combinations of these jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator Default algorithm : jasypt.encryptor.algorithm=PBEWithMD5AndDES jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator org.jasypt.salt.RandomSaltGenerator with/out provider and classname.
This was working with older version of Jasypt 1.18 and Spring Boot 2.1.x
provider as BC, classname : org.bouncycastle.jce.provider.BouncyCastleProvider
jasypt.encryptor.algorithm=${encryption_algorithm:PBEWITHSHAAND256BITAES-CBC-BC}