I have a Spring Boot project in which Flyway is used along with JPA.
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
The project is running absolutely fine. Due to some requirements I had to change the order of Flyway loading so it is loaded after the Hibernate. I searched and found the following solution https://stackoverflow.com/a/44806540/1361888
. I created the MigrationConfiguration
as suggested as answer in the above link. Now when I run the application then it gives me following error,
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method flywayInitializer in
com.x2iq.microservice.config.MigrationConfiguration required a bean of type
'org.flywaydb.core.Flyway' that could not be found.
Action:
Consider defining a bean of type 'org.flywaydb.core.Flyway' in your
configuration.
Now I fairly new to Spring Boot so unable to understand this error and I could not find anything related to this error online.
In a @Configuration
class you would want to expose a Flyway Bean to the container. Something like this should do the trick:
@Configuration
public class MigrationConfiguration {
@Bean
public Flyway flyway(){
return new Flyway();
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments