Reputation: 188
I have a use case where a single kafka stream processing MS will have a processor and a consumer which will consume the processor output message. Similar to below sample in github
while executing the above sample I getting following error
***************************
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
Upvotes: 1
Views: 1880
Reputation: 21
This error occurred for me while I was using @SpringBootApplication and @EnableBinding( Processor.class ) outside of the class that was running my project, in conjunction with both of the dependencies below.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
</dependency>
Both of these dependencies provide a configuration for provisioningProvider, so to resolve the issue, we must specify which configuration to use.
In your application.yml file, set a default binder to resolve this issue.
spring:
cloud:
stream:
kafka:
binder:
brokers: localhost
defaultBrokerPort: 9092
bindings:
output:
binder: name-of-target-binder
destination: sample-topic
defaultBinder: name-of-target-binder
The documentation here, Section 7.4 Multiple Binders on the Classpath, provides further insight into this issue.
Upvotes: 2
Reputation: 1529
I had a similar issue, and I fixed it by adding in my pom:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Upvotes: 0
Reputation: 3238
This seems to be some kind of screw-up from the side of Spring Cloud.
This cryptic thread proposed downgrading the dependencies (org.springframework.cloud:spring-cloud-stream-binder-kafka-streams
and org.springframework.cloud:spring-cloud-stream
for me) from 3.0.1.RELEASE
to 3.0.0.RELEASE
.
This was indeed the fix for my version of this problem, and I guess it is for you, too.
Upvotes: 1