0

I did configuration for flywaydb + Spring boot which works perfectly following the link below https://flywaydb.org/documentation/plugins/springboot

Flyway is using default datasource which is provided to it via application.properties - entries are

spring.datasource.url= <DB_URL>
spring.datasource.username=testdb
spring.datasource.password=dbpass

Now I am adding JASYPT to the app so that I can encrypt the password.

  <dependency>
                <groupId>org.jasypt</groupId>
                <artifactId>jasypt-spring31</artifactId>
                <version>1.9.2</version>
            </dependency> 

I encrypted password using JASYPT command line and updated it to file i.e

spring.datasource.password= ENC(EFXC0ORLK+Uy6f)

Then on java side, added a Bean which loads properties using org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer with static method

Also I have made sure that above Bean actually decrypts the password using loggers.

But whenever I run my app it fails with error FATAL: password authentication failed for user - Somehow spring is using the properties before its getting decrypt.

Any ideas? Thanks

1 Answers1

0

Had the same problem and it looks like a bug in flyway.

Work around is to set spring.flyway.password=ENC(...)

Jan
  • 46
  • 1
  • 9