Reputation: 14551
I have a Spring Boot application in which a Bean loads configuration-data from the database.
Right now I set up this Bean in the Configuration class. But it seems it loads before Flyway
.
How to make sure Flyway
has finished it's job before my beans get loaded?
Upvotes: 2
Views: 1692
Reputation: 24561
You can initialize it before you start Spring Boot application:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
// Init Flyway here
SpringApplication.run(Application.class, args);
}
}
Second option is to use @DependsOn
annotation for your beans depending on Flyway.
Upvotes: 2