Package com.alibaba.nacos.sys.env
Class NacosDuplicateSpringBeanPostProcessor
java.lang.Object
com.alibaba.nacos.sys.env.AbstractNacosDuplicateBeanPostProcessor
com.alibaba.nacos.sys.env.NacosDuplicateSpringBeanPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
Nacos
InstantiationAwareBeanPostProcessor to reduce duplicate rebuild bean for spring beans.
For some important spring beans like spring context beans, if reuse from parent, will cause some problem. So skip.
- Author:
- xiweng.yy
-
Constructor Summary
ConstructorsConstructorDescriptionNacosDuplicateSpringBeanPostProcessor(org.springframework.context.ConfigurableApplicationContext context) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisReUsingBean(Class<?> beanClass, String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) Judge whether re-use beans from core context.Methods inherited from class com.alibaba.nacos.sys.env.AbstractNacosDuplicateBeanPostProcessor
postProcessBeforeInstantiationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessAfterInitialization, postProcessBeforeInitializationMethods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
postProcessAfterInstantiation, postProcessProperties
-
Constructor Details
-
NacosDuplicateSpringBeanPostProcessor
public NacosDuplicateSpringBeanPostProcessor(org.springframework.context.ConfigurableApplicationContext context)
-
-
Method Details
-
isReUsingBean
protected boolean isReUsingBean(Class<?> beanClass, String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) Description copied from class:AbstractNacosDuplicateBeanPostProcessorJudge whether re-use beans from core context.- Specified by:
isReUsingBeanin classAbstractNacosDuplicateBeanPostProcessor- Parameters:
beanClass- bean classbeanName- bean namebeanDefinition- bean definition- Returns:
truemeans re-use beans from core context, otherwisefalsemeans to re-build bean in sub context.
-