The case which we have to reproduce is located in the Spring XD META-INF/spring-xd/batch/singlestep-partition-support.xml and represents the partitionHandler which has a reference to the auto-created setHeaderReplyChannelChannel.
INT-3583 we have AggregatorFactoryBean which is FactoryBean and in this case it gets a reference to that partitionHandler.
From other side JmxIntegrationConfigurationInitializer has a code like this:
which is bad for that AggregatorFactoryBean because this method initiate
- @param allowEagerInit whether to initialize <i>lazy-init singletons</i> and
- <i>objects created by FactoryBeans</i> (or by factory methods with a
- "factory-bean" reference) for the type check. Note that FactoryBeans need to be
- eagerly initialized to determine their type: So be aware that passing in "true"
- for this flag will initialize FactoryBeans and "factory-bean" references.
Therefore we end up with:
That's because ChannelInitializer hasn't been started yet.
From one side it is good to have all explicit channel bean definition, but from other side it would be better to revise all ListableBeanFactory.getBeanNamesForType(Class<?> beanClass usage and consider to go ahead with ListableBeanFactory.getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)