I would like to run my integration tests but I don't know how to disable @EnableKafka
.
My app looks like that:
@SpringBootApplication
@EnableKafka
public class MyApplication {
I would like to run my integration tests but I don't know how to disable @EnableKafka
.
My app looks like that:
@SpringBootApplication
@EnableKafka
public class MyApplication {
Spring Boot come with an auto-configuration for Spring Kafka, therefore you don't need to use an explicit @EnableKafka
. What you need to do in your test is just exclude KafkaAutoConfiguration
:
@SpringBootTest("spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration")
You can disable the autoconfiguration of Kafka with this Spring annotation:
@EnableAutoConfiguration(exclude = {KafkaAutoConfiguration.class})