Files
spring-integration/spring-integration-core/src/main
Artem Bilan 6fbeec67a5 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.

(cherry picked from commit c9e3de8767)
2025-03-28 18:36:11 +00:00
..