-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
type: bugA general bugA general bug
Description
Hello,
Thank you a lot for your work.
I want to use the embedded PostgreSQL database along with flyway migrations, on a SpringBoot application.
When I run this test :
@SpringBootTest
@ExtendWith(FlywayTestExtension.class)
@AutoConfigureEmbeddedDatabase(beanName = "libraryDataSource")
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, OptimizedFlywayTestExecutionListener.class })
@FlywayTest(flywayName = "libraryFlyway")
class InsertingBookTest {
@Autowired
private BookRepository bookRepository;
@Test
void testGetFirstBook() {
assertThat(bookRepository.findFirstByName("my book")).isNotNull();
}
}It fails with the following exception :
java.lang.IllegalStateException: Using org.flywaydb.test.FlywayTestExecutionListener and org.flywaydb.test.junit.FlywayTestExecutionListener is forbidden, use io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener instead
at io.zonky.test.db.flyway.FlywayDatabaseExtension$FlywayDatabaseExtensionInterceptor.apply(FlywayDatabaseExtension.java:186)
at io.zonky.test.db.flyway.FlywayDatabaseExtension$FlywayDatabaseExtensionInterceptor.invoke(FlywayDatabaseExtension.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:728)
at org.flywaydb.core.Flyway$$SpringCGLIB$$0.clean(<generated>)
at org.flywaydb.test.FlywayTestExecutionListener.dbResetWithAnnotation(FlywayTestExecutionListener.java:381)
at org.flywaydb.test.FlywayTestExecutionListener.handleFlywayTestAnnotationForClass(FlywayTestExecutionListener.java:181)
at org.flywaydb.test.FlywayTestExecutionListener.beforeTestClass(FlywayTestExecutionListener.java:160)
Here is my dependencies :
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb.flyway-test-extensions</groupId>
<artifactId>flyway-spring-test</artifactId>
<version>10.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-postgres</artifactId>
<version>1.2.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-database-spring-test</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>For the sake of bug reproducing, you can use my repository : https://github.com/ii02735/spring-boot-flywaytest-multiple-datasources
Thank you a lot for your help.
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug