Class AbstractBeanFactoryAwareAdvisingPostProcessor
- All Implemented Interfaces:
Serializable, AopInfrastructureBean, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, SmartInstantiationAwareBeanPostProcessor, Ordered
- Direct Known Subclasses:
AsyncAnnotationBeanPostProcessor, ConcurrencyLimitBeanPostProcessor, MethodValidationPostProcessor, PersistenceExceptionTranslationPostProcessor, RetryAnnotationBeanPostProcessor
AbstractAdvisingBeanPostProcessor 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
FieldsFields inherited from class AbstractAdvisingBeanPostProcessor
advisor, beforeExistingAdvisorsFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisEligible(Object bean, String beanName) Check whether the given bean is eligible for advising with this post-processor'sAdvisor.protected ProxyFactoryprepareProxyFactory(Object bean, String beanName) Prepare aProxyFactoryfor the given bean.voidsetBeanFactory(BeanFactory beanFactory) Callback that supplies the owning factory to a bean instance.Methods inherited from class AbstractAdvisingBeanPostProcessor
customizeProxyFactory, determineBeanType, isEligible, postProcessAfterInitialization, setBeforeExistingAdvisorsMethods inherited from class ProxyProcessorSupport
evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoaderMethods inherited from class ProxyConfig
copyDefault, copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BeanPostProcessor
postProcessBeforeInitializationMethods inherited from interface InstantiationAwareBeanPostProcessor
postProcessAfterInstantiation, postProcessBeforeInstantiation, postProcessPropertiesMethods inherited from interface SmartInstantiationAwareBeanPostProcessor
determineCandidateConstructors, getEarlyBeanReference, predictBeanType
-
Field Details
-
beanFactory
-
-
Constructor Details
-
AbstractBeanFactoryAwareAdvisingPostProcessor
public AbstractBeanFactoryAwareAdvisingPostProcessor()
-
-
Method Details
-
setBeanFactory
Description copied from interface:BeanFactoryAwareCallback 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:
setBeanFactoryin interfaceBeanFactoryAware- Parameters:
beanFactory- owning BeanFactory (nevernull). The bean can immediately call methods on the factory.- See Also:
-
prepareProxyFactory
Description copied from class:AbstractAdvisingBeanPostProcessorPrepare aProxyFactoryfor 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(ProxyFactory)allows for late customizations of those parts right before proxy creation.- Overrides:
prepareProxyFactoryin classAbstractAdvisingBeanPostProcessor- Parameters:
bean- the bean instance to create a proxy forbeanName- the corresponding bean name- Returns:
- the ProxyFactory, initialized with this processor's
ProxyConfigsettings and the specified bean - See Also:
-
isEligible
Description copied from class:AbstractAdvisingBeanPostProcessorCheck 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, for example, to specifically exclude certain beans by name.Note: Only called for regular bean instances but not for existing proxy instances which implement
Advisedand allow for adding the localAdvisorto the existing proxy'sAdvisorchain. 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:
isEligiblein classAbstractAdvisingBeanPostProcessor- Parameters:
bean- the bean instancebeanName- the name of the bean- See Also:
-