From 70f9ddbe7ed8b96164ddeb918220b7f3ca121758 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 30 Jun 2022 16:46:39 +0200 Subject: [PATCH] splitter: 1.0.0-spring-integration-xml - defined the `DirectChannel` in XML --- .../wordcount/splitter/SplitterApplication.java | 11 ++--------- src/main/resources/integration.xml | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 src/main/resources/integration.xml diff --git a/src/main/java/de/juplo/kafka/wordcount/splitter/SplitterApplication.java b/src/main/java/de/juplo/kafka/wordcount/splitter/SplitterApplication.java index d9ba135..fd3becd 100644 --- a/src/main/java/de/juplo/kafka/wordcount/splitter/SplitterApplication.java +++ b/src/main/java/de/juplo/kafka/wordcount/splitter/SplitterApplication.java @@ -4,10 +4,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ImportResource; import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.annotation.InboundChannelAdapter; import org.springframework.integration.annotation.ServiceActivator; -import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.config.EnableIntegration; import org.springframework.integration.kafka.inbound.KafkaMessageSource; import org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler; @@ -26,16 +26,9 @@ import org.springframework.messaging.support.ChannelInterceptor; @SpringBootApplication @EnableConfigurationProperties(SplitterApplicationProperties.class) @EnableIntegration +@ImportResource("classpath:integration.xml") public class SplitterApplication { - @Bean - MessageChannel words(ChannelInterceptor keyInterceptor) - { - DirectChannel words = new DirectChannel(); - words.addInterceptor(keyInterceptor); - return words; - } - @Bean ChannelInterceptor keyInterceptor () { diff --git a/src/main/resources/integration.xml b/src/main/resources/integration.xml new file mode 100644 index 0000000..c632967 --- /dev/null +++ b/src/main/resources/integration.xml @@ -0,0 +1,15 @@ + + + + + + + + + + -- 2.20.1