'Spring Boot use separate user for flywaydb and JPA
flyway.password=pwd2 #does not take effect
flyway.user=user2 #does not take effect
spring.datasource.username=user1
spring.datasource.password=pwd1
user1/pwd1 is used to run flyway db migrations as well as DML operations via JPA. Is there a way to get flyway db to use another credentials?
Solution 1:[1]
I got it to work by specifying flyway.url too.
Solution 2:[2]
It seems you are mixing the Spring config file with the Flyway config file. Try putting the Flyway config in a flyway.conf
file instead of Spring's application.yml
config file.
Alternatively, you can use Flyway environment variables like SPRING_FLYWAY_USER
and SPRING_FLYWAY_PASSWORD
. This is usually a good practice (secured) on cloud environments, as it can be filled from so-called secrets.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ajay |
Solution 2 |