Search code examples
javaspringspring-bootflyway

upgrade flyway in spring from 5.2.3 to 6.X - org.flywaydb.core.api.callback.FlywayCallback not present


I'm using spring boot 2.1.0 and flyway version 5.4. In my pom.xml file I didnt mention flyway version and as a result of that mvn downloaded flyway version 5.X :

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
</dependency>

As part of my db upgrade I need to upgrade flyway to at least version 6. I tried adding tag in the pom.xml and maven indeed install the new version but when starting the app I'm getting the following error :

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Unexpected exception during bean creation; nested exception is java.lang.TypeNotPresentException: Type org.flywaydb.core.api.callback.FlywayCallback not present

Solution

  • The problem in my case was that flyway 6.0+ was incompatible to work with spring 2.1.1 . I upgraded spring-boot to 2.2 and it solved my issue.