当前位置: 首页 > 知识库问答 >
问题:

Spring cloud stream多绑定器错误KStreamBinderConfiguration需要一个bean,但找到了2个

温凯
2023-03-14

我有一个用例,其中处理MS的单个kafka流将有一个处理器和一个消费者,消费者将使用处理器输出消息。类似于下面github中的示例

https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/kafka-streams-samples/kafka-streams-message-channel

在执行上面的示例时,我得到以下错误

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method provisioningProvider in org.springframework.cloud.stream.binder.kafka.streams.KStreamBinderConfiguration required a single bean, but 2 were found:
    - kafkaBinderConfigurationProperties: defined by method 'kafkaBinderConfigurationProperties' in org.springframework.cloud.stream.binder.kafka.streams.MutliBinderPropertiesConfiguration
    - binderConfigurationProperties: defined by method 'binderConfigurationProperties' in class path resource [org/springframework/cloud/stream/binder/kafka/streams/KafkaStreamsBinderSupportAutoConfiguration.class]


Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

共有1个答案

龙飞文
2023-03-14

这似乎是春云这边的某种搞砸。

这个神秘的线程建议将依赖项(org.springframework.cloud:spring-cloud-stream-binder-kafka-streamsorg.springframework.cloud:spring-cloud-streamfor me)从3.0.1.release下调到3.0.0.release

这确实是解决我版本的这个问题的方法,我想它也适用于您。

 类似资料: