Files
spring-integration/spring-integration-core/src
Artem Bilan c9e3de8767 GH-9931: Make consumer endpoints dependant on ChannelInitializer
Fixes: #9931
Issue link: https://github.com/spring-projects/spring-integration/issues/9931

If no message channel bean is declared explicitly, the XML parser for endpoints
register such a candidate into the global `ChannelInitializer`.
This way, the channel is created when this bean is initialized.
However, there are cases when endpoint bean could be called before `ChannelInitializer` initialization.

* Add `consumerEndpointBuilder.addDependsOn(IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME);`
into the `AbstractConsumerEndpointParser` to ensure that `ChannelInitializer` bean is initialized
before the called endpoint bean.
* Adjust `ChannelInitializer` logic to use `registerSingleton()` API instead of `registerBeanDefinition()`
since the last one may cause problems with beans cache when this API is called at runtime.

**Auto-cherry-pick to `6.4.x`**
2025-03-28 14:35:46 -04:00
..