I'm using a base integration test with these annotations:
@ExtendWith(SpringExtension::class) @SpringBootTest(classes = [SomeApplication::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @DataMongoTest @EmbeddedKafka( partitions = 3, controlledShutdown = false, brokerProperties = ["listeners=PLAINTEXT://127.0.0.1:9092", "port=9092"]) abstract class IntegrationTestBase { When I run the test i get this error:
java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [com.some.app.application.restapi.DatabaseSetupApiEte]: [@org.springframework.test.context.BootstrapWith(value=org.springframework.boot.test.context.SpringBootTestContextBootstrapper), @org.springframework.test.context.BootstrapWith(value=org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTestContextBootstrapper)] The error is caused by both annotations @SpringBootTest and @DataMongoTest including @BootstrapWith like this:
@SpringBootTest has @BootstrapWith(SpringBootTestContextBootstrapper.class) @DataMongoTest has @BootstrapWith(DataMongoTestContextBootstrapper.class) I need to keep using @SpringBootTest for SpringBootTest.WebEnvironment.RANDOM_PORT but i also want the embedded mongodb from @DataMongoTest
Any suggestions?