spring-cloud / spring-cloud/spring-cloud-stream
Auto register functionals beans as spring cloud stream bindings
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
When configuring an application with spring cloud stream, if there is a bean that implements a functional interface even if its purpose is neither to publish nor to subscribe to events, spring cloud stream detects it and tries to create the provisioning of the target, and even if the bean is a supplier, it even sends events.
This happens as long as there is no more than one bean in the spring context of type Function, Consumer or Supplier, even if you set the property "spring.cloud.function.scan.enabled" to false.
This can be a problem in applications where you only want to use StreamBridge to produce events and for other reasons there is a bean that implements a functional interface in the spring context.
Is this the desired behaviour?
To Reproduce
Attached is an application that reproduces the problem.
demoStreamKafka.zip
Version of the framework
spring-cloud 2020.0.2
spring-cloud-stream 3.1.2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the attached demoStreamKafka.zip application with spring-cloud 2020.0.2 and spring-cloud-stream 3.1.2. Inspect how a single Function, Consumer, or Supplier bean is detected when spring.cloud.function.scan.enabled is false, and compare that with the intended StreamBridge-only use case. Done means the expected binding behavior is established and the reproduction no longer provisions or sends unintended events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100