Class ListMergeDirectiveBeanPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
ListMergeDirectiveBeanPostProcessor
It creates a cache of ListMergeDirective bean definitions found in the system during its initialization. Then
each bean is checked if it should be modified by any of cached directives. If yes, we use
BeanDefinitionValueResolver (custom implementation of spring class) to create a object out of beanDefiniton
without creating a proper ListMergeDirective bean (this is impossible at this point as it would create
circular dependency). The representation of ListMergeDirective is then applied to target bean.
Forcing this BeanPostProcessor to load all ListMergeDirective instances during its initialization (via
dependency injection or by extracting them form ApplicationContext) will lead to change in order in which beans are
intialized. Especially some beans will be instanciated before other BeanPostProcessors which may highly affect
stability of the system, so its a bad idea.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates cache of listMergeDirective beanDefinitions.getListByDependency(Object dependency, String dependencyName, String directiveBeanName) getListByPropertyDescriptor(Object bean, String beanName, String propertyDescriptor, String directiveBeanName) getListByReflection(Object bean, String beanName, String fieldName, String directiveBeanName) protected booleanisSupportedClass(String name) postProcessAfterInitialization(Object bean, String beanName) postProcessBeforeInitialization(Object bean, String beanName) protected voidprocessMergeDirective(ListMergeDirective listMergeDirective, String lmdBeanName, Object targetBean, String targetName) resolveListBean(ListMergeDirective lmd, String directiveBeanName, Object bean, String beanName) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) protected booleanshouldApplyMergeDirectiveBean(String beanName)
-
Constructor Details
-
ListMergeDirectiveBeanPostProcessor
public ListMergeDirectiveBeanPostProcessor()
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
Creates cache of listMergeDirective beanDefinitions.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
isSupportedClass
-
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessBeforeInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessAfterInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
shouldApplyMergeDirectiveBean
-
processMergeDirective
protected void processMergeDirective(ListMergeDirective listMergeDirective, String lmdBeanName, Object targetBean, String targetName) -
resolveListBean
-
getListByDependency
-
getListByPropertyDescriptor
-
getListByReflection
-