Package org.springframework.aop.framework.autoproxy

# Class AbstractBeanFactoryAwareAdvisingPostProcessor

java.lang.Object
org.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.ProxyProcessorSupport
org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor
org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor

All Implemented Interfaces:
  `Serializable`, `AopInfrastructureBean`, `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.BeanClassLoaderAware`, `org.springframework.beans.factory.BeanFactoryAware`, `org.springframework.beans.factory.config.BeanPostProcessor`, `org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor`, `org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor`, `org.springframework.core.Ordered`

public abstract class AbstractBeanFactoryAwareAdvisingPostProcessor extends AbstractAdvisingBeanPostProcessor implements org.springframework.beans.factory.BeanFactoryAware
Extension of `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:
  - `AutoProxyUtils.shouldProxyTargetClass(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.lang.String)`
  - `AutoProxyUtils.determineTargetClass(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.lang.String)`
  - Serialized Form

## 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

Constructors
Constructor
Description
`AbstractBeanFactoryAwareAdvisingPostProcessor()`

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`isEligible(Object bean, String beanName)`
Check whether the given bean is eligible for advising with this post-processor's `Advisor`.
`protected ProxyFactory`
`prepareProxyFactory(Object bean, String beanName)`
Prepare a `ProxyFactory` for the given bean.
`void`
`setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)`

### 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

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

Specified by:
  `setBeanFactory` in interface `org.springframework.beans.factory.BeanFactoryAware`

### prepareProxyFactory

protected ProxyFactory prepareProxyFactory(Object bean, String beanName)
Description copied from class: `AbstractAdvisingBeanPostProcessor`
Prepare a `ProxyFactory` 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 class `AbstractAdvisingBeanPostProcessor`
Parameters:
  `bean` - the bean instance to create a proxy for
  `beanName` - the corresponding bean name
Returns:
  the ProxyFactory, initialized with this processor's `ProxyConfig` settings and the specified bean
See Also:
  - `AbstractAdvisingBeanPostProcessor.customizeProxyFactory(org.springframework.aop.framework.ProxyFactory)`

### isEligible

protected boolean isEligible(Object bean, String beanName)
Description copied from class: `AbstractAdvisingBeanPostProcessor`
Check whether the given bean is eligible for advising with this post-processor's `Advisor`.

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 `Advised` and allow for adding the local `Advisor` to the existing proxy's `Advisor` chain. For the latter, `AbstractAdvisingBeanPostProcessor.isEligible(Class)` is being called directly, with the actual target class behind the existing proxy (as determined by `AopUtils.getTargetClass(Object)`).

Overrides:
  `isEligible` in class `AbstractAdvisingBeanPostProcessor`
Parameters:
  `bean` - the bean instance
  `beanName` - the name of the bean
See Also:
  - `AbstractAdvisingBeanPostProcessor.isEligible(Class)`