spring-cloud/spring-cloud-stream-binder-aws-kinesis

kafkaExtendedPropertiesDefaultMappingsProvider bean naming conflict

beccagaspard opened this issue · 1 comments

In what version(s) of Spring Cloud Stream Binder for AWS Kinesis are you seeing this issue?

4.0.1

Describe the bug
When including both org.springframework.cloud:spring-cloud-stream-binder-kafka and org.springframework.cloud:spring-cloud-stream-binder-kinesis on the classpath, I get the following error:

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

Description:

The bean 'kafkaExtendedPropertiesDefaultMappingsProvider', defined in class path resource [org/springframework/cloud/stream/binder/kinesis/config/ExtendedBindingHandlerMappingsProviderConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/stream/binder/kafka/config/ExtendedBindingHandlerMappingsProviderConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

org.springframework.cloud.stream.binder.kinesis.config.ExtendedBindingHandlerMappingsProviderConfiguration defines a bean called kafkaExtendedPropertiesDefaultMappingsProvider - I'm thinking maybe this is a copy/paste error and it should have been named kinesisExtendedPropertiesDefaultMappingsProvider instead?

See commit 4c80635

See code https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/blob/main/spring-cloud-stream-binder-kinesis/src/main/java/org/springframework/cloud/stream/binder/kinesis/config/ExtendedBindingHandlerMappingsProviderConfiguration.java#L36

Relates to spring-cloud/spring-cloud-stream#2806

To Reproduce

Include org.springframework.cloud:spring-cloud-stream-binder-kafka and org.springframework.cloud:spring-cloud-stream-binder-kinesis:4.0.1 in the same project. Application will fail to start.

Expected behavior

Developers should be able to use kafka and kinesis binders in the same application.

Sample

https://github.com/beccagaspard/spring-kafka-kinesis-bug

Try to run application, or see failing test in SpringKafkaKinesisBugApplicationTests.

That was a copy/paste mistake.
Sorry for inconvenience.