From 5cfce42d2e52b93c28585e78b712bcff82d3ed75 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Mon, 23 Dec 2019 18:58:58 -0500 Subject: [PATCH] Kafka Streams multi binder configuration In the mutli binder scenario, make KafkaBinderConfigurationProperties conditional so that it only creates such a bean in the correspodig multi binder context. For normal cases, KafkaBinderConfigurationProperties bean is created by the main context. --- .../kafka/streams/MutliBinderPropertiesConfiguration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/MutliBinderPropertiesConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/MutliBinderPropertiesConfiguration.java index 07df15cd3..7e60e212e 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/MutliBinderPropertiesConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/MutliBinderPropertiesConfiguration.java @@ -16,6 +16,7 @@ package org.springframework.cloud.stream.binder.kafka.streams; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.kafka.KafkaProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.stream.binder.kafka.properties.KafkaBinderConfigurationProperties; @@ -28,6 +29,7 @@ public class MutliBinderPropertiesConfiguration { @Bean @ConfigurationProperties(prefix = "spring.cloud.stream.kafka.streams.binder") + @ConditionalOnBean(name = "outerContext") public KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties(KafkaProperties kafkaProperties) { return new KafkaStreamsBinderConfigurationProperties(kafkaProperties); }