-
Notifications
You must be signed in to change notification settings - Fork 243
BusEnvironmentPostProcessor rebuilds Bus Stream bindings from bootstrap-visible config on refresh, not from application.yml #286
Description
Hello,
I found what looks like a refresh inconsistency around spring.cloud.bus.destination when bootstrap is enabled.
I am not fully sure whether this is intended bootstrap-related behavior or a bug, but the result is surprising: the property works correctly at startup from application.yml, yet after refresh the derived Bus Stream binding destinations are rebuilt differently.
Versions
- Spring Boot:
3.5.11 - Spring Cloud:
2025.0.0 - spring-cloud-bus:
4.3.0 - spring-cloud-stream:
4.3.0
Sample project
Minimal reproducer:
https://github.com/AynurMuftakhov/demo-bus
Observed cases
Case 1 — spring.cloud.bus.destination only in application.yml
Startup is correct, but refresh is wrong.
Case 2 — move only spring.cloud.bus.destination to bootstrap.properties
Startup is correct, and refresh is also correct.
Case 3 — keep spring.cloud.bus.destination in application.yml, but explicitly set spring.cloud.stream.bindings.*.destination
Startup is correct, and refresh is also correct.
Problem summary
With spring-cloud-starter-bootstrap enabled:
- if
spring.cloud.bus.destinationis defined only inapplication.yml, startup works correctly - but after refresh, the derived properties
spring.cloud.stream.bindings.springCloudBusInput.destinationand
spring.cloud.stream.bindings.springCloudBusOutput.destination
are reset to the default valuespringCloudBus
As a result, after refresh and rebinding, publishing starts using the default exchange instead of the custom one.
Expected behavior
If spring.cloud.bus.destination is defined in application.yml and works at startup, I would expect refresh to preserve or recompute the same Bus-derived Stream binding destinations consistently.
At minimum, if this is expected behavior with bootstrap enabled, it would be helpful to document clearly that spring.cloud.bus.destination must be bootstrap-visible for refresh-time reconstruction.
Additional observation
From debugging, BusEnvironmentPostProcessor is invoked during refresh, but only in the bootstrap-related refresh path.
That means:
- properties from
bootstrap.propertiesare seen and applied - properties from
application.ymlare not used to rebuild the Bus-derived Stream binding destinations
Question
Is it expected that with bootstrap enabled, spring.cloud.bus.destination must be in bootstrap.properties for refresh to rebuild Bus-derived Stream binding destinations correctly?
If not, should refresh also rebuild these derived properties from application.yml?
Thank you.