You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AbstractConsumerEndpointParser produces a ConsumerEndpointFactoryBean which has to be initialized when BeanFactory requests a bean type. If inputChannel is not present in the BeanFactory that leads to the problem.
Making the IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME as dependency on such an endpoint bean definition should trigger the ChannelInitializer to be initialized. Therefore all the auto-create channel candidates will be created upfront.
Side task.
Revise IntegrationConfigUtils.autoCreateDirectChannel() to use registerSingleton() instead this this functionality is called at runtime from that ChannelInitializer.afterPropertiesSet().
The text was updated successfully, but these errors were encountered:
Fixes: #9931
Issue link: #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 c9e3de8)
See more info in the spring-projects/spring-boot#44873.
The
AbstractConsumerEndpointParser
produces aConsumerEndpointFactoryBean
which has to be initialized whenBeanFactory
requests a bean type. IfinputChannel
is not present in theBeanFactory
that leads to the problem.Making the
IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME
as dependency on such an endpoint bean definition should trigger theChannelInitializer
to be initialized. Therefore all the auto-create channel candidates will be created upfront.Side task.
Revise
IntegrationConfigUtils.autoCreateDirectChannel()
to useregisterSingleton()
instead this this functionality is called at runtime from thatChannelInitializer.afterPropertiesSet()
.The text was updated successfully, but these errors were encountered: