From: Kai Moritz Date: Sat, 21 Mar 2026 12:14:12 +0000 (+0100) Subject: Doku von Spring Kafka empfiehlt `@DirtiesContext` bei `@EmbeddedKafka` X-Git-Tag: consumer/spring-consumer--2026-03-22--22-01 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fconsumer%2Fspring-consumer;p=demos%2Fkafka%2Ftraining Doku von Spring Kafka empfiehlt `@DirtiesContext` bei `@EmbeddedKafka` * In diesem einfachen Test ist die Annotation eigentlich überflüssig --- diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index 61197cbf..0ad310b3 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.kafka.test.context.EmbeddedKafka; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.web.servlet.MockMvc; import java.time.Duration; @@ -23,6 +24,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. "juplo.consumer.topic=" + TOPIC }) @AutoConfigureMockMvc @EmbeddedKafka(topics = TOPIC, partitions = PARTITIONS) +@DirtiesContext public class ApplicationTests { static final String TOPIC = "FOO";