Jasypt fails to bind properties 'spring.datasource.password' while using with ENC()

317 views Asked by At

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:

  1. Upgrading/downgrading the Maven dependency jasypt-spring-boot-starter version 3.x,2.0.0
  2. Passing -Djasypt.encryptor.password= or -DJASYPT_ENCRYPTOR_PASSWORD= as JVM argument
  3. Setting spring.datasource.password=ENC(encrypted_password)
  4. 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}

0

There are 0 answers