You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fails if Spring Integration JDBC, Flyway and an embedded database is used since Spring Boot v2.5.3 with:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Found non-empty schema(s) "PUBLIC" but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.
The problem is that with embedded database tests IntegrationJdbcConfiguration with IntegrationDataSourceInitializer (from Spring Boot autoconfiguration) runs after Flyway in Spring Boot v2.5.1 and since Spring Boot v2.5.3 before Flyway hence the database is not empty and Flyway fails.
I suggest to add @AutoConfigureAfter(FlywayAutoConfiguration.class) to IntegrationJdbcConfiguration. And check this also for Liquibase.
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
Spring Boot since 2.5.3 fails simple @SpringBootTest w/ Flyway and Spring Integration JDBC
Startup failure when using Flyway and Spring Integration's DataSource initialization
Sep 22, 2021
wilkinsona
changed the title
Startup failure when using Flyway and Spring Integration's DataSource initialization
Startup failure due to non-empty schema when using Flyway and Spring Integration's DataSource initialization
Sep 22, 2021
This is due to the changes made in 433f3d6 for #27215. The problem is that the new AbstractDataSourceInitializerDatabaseInitializerDetector is unordered so the initializers that it detects end up running before Flyway (and Liquibase). The problem doesn't occur in 2.6 due to the changes made for #27206.
A simple test
fails if Spring Integration JDBC, Flyway and an embedded database is used since Spring Boot v2.5.3 with:
A minimal failing example can be found here https://github.com/agebhar1/spring-boot-flyway-si-jdbc and the details for running tests here https://github.com/agebhar1/spring-boot-flyway-si-jdbc/actions/runs/1258717007.
The problem is that with embedded database tests
IntegrationJdbcConfiguration
withIntegrationDataSourceInitializer
(from Spring Boot autoconfiguration) runs after Flyway in Spring Boot v2.5.1 and since Spring Boot v2.5.3 before Flyway hence the database is not empty and Flyway fails.I suggest to add
@AutoConfigureAfter(FlywayAutoConfiguration.class)
toIntegrationJdbcConfiguration
. And check this also for Liquibase.The text was updated successfully, but these errors were encountered: