Skip to content

TestChannelBinder is exposed without including TestChannelBinderConfiguration #2931

@Laksuh

Description

@Laksuh

Description
The TestChannelBinder is initialized in spring context during tests even though it was never configured to be. This issue is there since 4.1.1 (we upgraded from spring cloud 2023.0.0 to 2023.0.1).
The docs clearly say, that you have to add the TestChannelBinderConfiguration in order to activate the TestChannelBinder. In an integration test where we wanted to test with an EmbeddedKafka (or a local one), we were not able to make our consumer connect to our topics. We found out that the TestChannelBinder ist exposed and used, which was why we could not consume any messages.

To Reproduce
Steps to reproduce the behavior:
We have setup an example project which is able to reproduce the issue: https://github.com/Akkjon/kafka-bug-demo

  1. clone the example project
  2. check if you have a local instance of kafka on port 9092 or use the embedded Kafka in the test class uncomment in Line 21 to use the embedded Kafka
  3. run mvn clean test and see that the test will fail
  4. change the version of spring cloud from 2023.0.1 back to 2023.0.0
  5. run mvn clean test again and see the tests succeeding

Version of the framework
Spring Boot 3.2.4,
Spring Cloud 2023.0.1,
JDK 21

Expected behavior
Since we did not include the TestChannelBinderConfiguration in the test class (nor anywhere in the code), we would expect the KafkaMessageChannelBinder to be used.

@Akkjon

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions