GH-2282 Ensure BeanPostProcessors do not triger early initialization

Also, removed dead references and comments to legacy post processors
Resolves #2282
This commit is contained in:
Oleg Zhurakousky
2022-02-16 10:08:37 +01:00
parent 5c62dd6b55
commit 7c5c0c34c3
2 changed files with 2 additions and 20 deletions

View File

@@ -16,13 +16,12 @@
package org.springframework.cloud.stream.binding;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.integration.router.AbstractMappingMessageRouter;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.core.DestinationResolver;
/**
* A {@link BeanPostProcessor} that sets a BinderAwareChannelResolver on any bean
* Sets a BinderAwareChannelResolver on any bean
* of type {@link AbstractMappingMessageRouter} within the context.
*
* @author Mark Fisher

View File

@@ -88,12 +88,6 @@ import org.springframework.util.ObjectUtils;
@ConditionalOnBean(value = BinderTypeRegistry.class, search = SearchStrategy.CURRENT)
public class BindingServiceConfiguration {
/**
* Name of the Spring Cloud Stream stream listener annotation bean post processor.
*/
public static final String STREAM_LISTENER_ANNOTATION_BEAN_POST_PROCESSOR_NAME = "streamListenerAnnotationBeanPostProcessor";
@Autowired(required = false)
private Collection<DefaultBinderFactory.Listener> binderFactoryListeners;
@@ -155,7 +149,7 @@ public class BindingServiceConfiguration {
}
@Bean
public BeanPostProcessor globalErrorChannelCustomizer() {
public static BeanPostProcessor globalErrorChannelCustomizer() {
return new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
@@ -237,17 +231,6 @@ public class BindingServiceConfiguration {
return new DynamicDestinationsBindable();
}
// @Bean
// @ConditionalOnMissingBean
// public BinderAwareRouter binderAwareRouterBeanPostProcessor(
// @Autowired(required = false) List<AbstractMappingMessageRouter> routers,
// @Autowired(required = false) @Qualifier("binderAwareChannelResolver")
// DestinationResolver<MessageChannel> channelResolver) {
// final AbstractMappingMessageRouter[] routersArray = CollectionUtils.isEmpty(routers) ?
// new AbstractMappingMessageRouter[]{} : routers.toArray(new AbstractMappingMessageRouter[]{});
// return new BinderAwareRouter(routersArray, channelResolver);
// }
@Bean
public ApplicationListener<ContextRefreshedEvent> appListener(
SpringIntegrationProperties springIntegrationProperties) {