From 6c98ba6b2b1eb80ff1da834e7fffb600214ded4f Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 19 Nov 2021 13:12:18 -0800 Subject: [PATCH] Fix spring-kafka latest dep tests (#4676) --- .../SpringKafkaInstrumentationTest.groovy | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/groovy/SpringKafkaInstrumentationTest.groovy b/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/groovy/SpringKafkaInstrumentationTest.groovy index f66082b1b3..9548505f44 100644 --- a/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/groovy/SpringKafkaInstrumentationTest.groovy +++ b/instrumentation/spring/spring-kafka-2.7/javaagent/src/test/groovy/SpringKafkaInstrumentationTest.groovy @@ -215,14 +215,9 @@ class SpringKafkaInstrumentationTest extends AgentInstrumentationSpecification { .build() } - @KafkaListener(id = "testListener", topics = "testTopic", containerFactory = "batchFactory") - void listener(List> records) { - runInternalSpan("consumer") - records.forEach({ record -> - if (record.value() == "error") { - throw new IllegalArgumentException("boom") - } - }) + @Bean + Listener listener() { + return new Listener() } @Bean @@ -241,4 +236,17 @@ class SpringKafkaInstrumentationTest extends AgentInstrumentationSpecification { factory } } + + static class Listener { + + @KafkaListener(id = "testListener", topics = "testTopic", containerFactory = "batchFactory") + void listener(List> records) { + runInternalSpan("consumer") + records.forEach({ record -> + if (record.value() == "error") { + throw new IllegalArgumentException("boom") + } + }) + } + } }