GH-3694: Resolve circular dep in PublisherAnnBPP (#3695)

* GH-3694: Resolve circular dep in PublisherAnnBPP

Fixes https://github.com/spring-projects/spring-integration/issues/3694

* Move check for `PublisherAnnotationBeanPostProcessor` bean into the
`SmartInitializingSingleton.afterSingletonsInstantiated()` to break a circular dependency revealed
in the `InitializingBean.afterPropertiesSet()`

* * Fix unused import
This commit is contained in:
Artem Bilan
2021-12-14 14:41:58 -05:00
committed by GitHub
parent b424cbe171
commit 2a3dac7ff3

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@ import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvis
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.beans.factory.SmartInitializingSingleton;
/**
* Post-processes beans that contain the
@@ -40,7 +40,7 @@ import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
*/
@SuppressWarnings("serial")
public class PublisherAnnotationBeanPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor
implements BeanNameAware, InitializingBean {
implements BeanNameAware, SmartInitializingSingleton {
private String defaultChannelName;
@@ -74,7 +74,7 @@ public class PublisherAnnotationBeanPostProcessor extends AbstractBeanFactoryAwa
}
@Override
public void afterPropertiesSet() {
public void afterSingletonsInstantiated() {
try {
this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class);
}