Bug: Two BinderConfigurationPropertiesBeans are created
See original GitHub issueUsing the Spring Initializr I create a pom for a vanilla spring-boot application containing Cloud Stream and Spring for Kafka Streams:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
WIth a very simple application class:
package test;
import org.apache.kafka.streams.kstream.KStream;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import java.util.function.Consumer;
@SpringBootApplication
public class KafkaTest {
@Bean
public Consumer<KStream<Object, String>> process() {
return input ->
input.foreach((key, value) -> {
System.out.println("Key: " + key + " Value: " + value);
});
}
public static void main(String[] args) {
SpringApplication.run(KafkaTest.class, args);
}
}
Running this application will fail:
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]
Other than the above, nothing is added to this project. (No application.properties either.)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Bug: Two BinderConfigurationPropertiesBeans are created ...
Using the Spring Initializr I create a pom for a vanilla spring-boot application containing Cloud Stream and Spring for Kafka Streams:
Read more >spring-cloud/spring-cloud - Gitter
I've written a Spring Cloud Function that creates a PDF file. If I run it as a Spring Boot application everything works as...
Read more >Spring Framework RCE, Early Announcement
Another viable workaround is to disable binding to particular fields by setting disallowedFields on WebDataBinder globally:
Read more >bean creation error when starting spring boot application
To elaborate on @M-deinum's comment, setting Spring Boot version to 2.3.4.RELEASE (instead of 2.4.2 in my case) solved the issue.
Read more >[Solved]-Add Cloud Firestore to Spring Boot REST API. Error ...
Error creating bean with name 'firebaseJwtDelegatingValidator'-kotlin. ... Search. score:3. Apparently there is a bug with the auto configuration.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There was a regression we found out in the latest Kafka Streams binder (3.0.1.RELEASE). Can you please downgrade the version of spring-cloud-stream-binder-Kafka-streams to 3.0.0.RELEASE (need to set this version in the maven pom). We already fixed it on the latest snapshot (3.0.2.BUILD-SNAPSHOT) and will be part of the next release. There is a workaround you can try on the current release, but if you can go back to the previous version, that is easier.
I just reproduced this with 3.0.3, is it supposed to be fixed?