Class AbstractBeanFactoryAwareAdvisingPostProcessor
- All Implemented Interfaces:
Serializable
,AopInfrastructureBean
,Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanPostProcessor
,InstantiationAwareBeanPostProcessor
,SmartInstantiationAwareBeanPostProcessor
,Ordered
- Direct Known Subclasses:
AsyncAnnotationBeanPostProcessor
,MethodValidationPostProcessor
,PersistenceExceptionTranslationPostProcessor
AbstractAutoProxyCreator
which implements BeanFactoryAware
,
adds exposure of the original target class for each proxied bean
(AutoProxyUtils.ORIGINAL_TARGET_CLASS_ATTRIBUTE
),
and participates in an externally enforced target-class mode for any given bean
(AutoProxyUtils.PRESERVE_TARGET_CLASS_ATTRIBUTE
).
This post-processor is therefore aligned with AbstractAutoProxyCreator
.- Since:
- 4.2.3
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from class org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor
advisor, beforeExistingAdvisors
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
isEligible
(Object bean, String beanName) Check whether the given bean is eligible for advising with this post-processor'sAdvisor
.protected ProxyFactory
prepareProxyFactory
(Object bean, String beanName) Prepare aProxyFactory
for the given bean.void
setBeanFactory
(BeanFactory beanFactory) Callback that supplies the owning factory to a bean instance.Methods inherited from class org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor
customizeProxyFactory, determineBeanType, isEligible, postProcessAfterInitialization, setBeforeExistingAdvisors
Methods inherited from class org.springframework.aop.framework.ProxyProcessorSupport
evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoader
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
Methods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
postProcessAfterInstantiation, postProcessBeforeInstantiation, postProcessProperties
Methods inherited from interface org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor
determineCandidateConstructors, getEarlyBeanReference, predictBeanType
-
Constructor Details
-
AbstractBeanFactoryAwareAdvisingPostProcessor
public AbstractBeanFactoryAwareAdvisingPostProcessor()
-
-
Method Details
-
setBeanFactory
Description copied from interface:BeanFactoryAware
Callback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- See Also:
-
prepareProxyFactory
Description copied from class:AbstractAdvisingBeanPostProcessor
Prepare aProxyFactory
for the given bean.Subclasses may customize the handling of the target instance and in particular the exposure of the target class. The default introspection of interfaces for non-target-class proxies and the configured advisor will be applied afterwards;
AbstractAdvisingBeanPostProcessor.customizeProxyFactory(org.springframework.aop.framework.ProxyFactory)
allows for late customizations of those parts right before proxy creation.- Overrides:
prepareProxyFactory
in classAbstractAdvisingBeanPostProcessor
- Parameters:
bean
- the bean instance to create a proxy forbeanName
- the corresponding bean name- Returns:
- the ProxyFactory, initialized with this processor's
ProxyConfig
settings and the specified bean - See Also:
-
isEligible
Description copied from class:AbstractAdvisingBeanPostProcessor
Check whether the given bean is eligible for advising with this post-processor'sAdvisor
.Delegates to
AbstractAdvisingBeanPostProcessor.isEligible(Class)
for target class checking. Can be overridden e.g. to specifically exclude certain beans by name.Note: Only called for regular bean instances but not for existing proxy instances which implement
Advised
and allow for adding the localAdvisor
to the existing proxy'sAdvisor
chain. For the latter,AbstractAdvisingBeanPostProcessor.isEligible(Class)
is being called directly, with the actual target class behind the existing proxy (as determined byAopUtils.getTargetClass(Object)
).- Overrides:
isEligible
in classAbstractAdvisingBeanPostProcessor
- Parameters:
bean
- the bean instancebeanName
- the name of the bean- See Also:
-