diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java index 4c1b8b525f..9b418f64e3 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java @@ -90,7 +90,14 @@ public class KafkaOutboundAdapterParserTests { public void testSyncMode() { @SuppressWarnings("resource") MockProducer mockProducer = - new MockProducer<>(false, new IntegerSerializer(), new StringSerializer()); + new MockProducer(false, new IntegerSerializer(), new StringSerializer()) { + + @Override + public void close() { + // To avoid non transactional closes. + } + + }; KafkaTemplate template = new KafkaTemplate<>(() -> mockProducer); KafkaProducerMessageHandler handler = new KafkaProducerMessageHandler<>(template); handler.setBeanFactory(mock(BeanFactory.class));