org.springframework.aop.framework

## 类 AbstractAdvisingBeanPostProcessor

- java.lang.Object
- - org.springframework.aop.framework.ProxyConfig
  - - org.springframework.aop.framework.ProxyProcessorSupport
    - - org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor

- 所有已实现的接口:
    Serializable, AopInfrastructureBean, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.Ordered
  直接已知子类:
    AbstractBeanFactoryAwareAdvisingPostProcessor

      public abstract class AbstractAdvisingBeanPostProcessor
      extends ProxyProcessorSupport
      implements org.springframework.beans.factory.config.BeanPostProcessor

  Base class for `BeanPostProcessor` implementations that apply a Spring AOP `Advisor` to specific beans.
  从以下版本开始:
    3.2
  作者:
    Juergen Hoeller
  另请参阅:
    序列化表格

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected Advisor` | `advisor`
    `protected boolean` | `beforeExistingAdvisors`

    - ### 从接口继承的字段 org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

    构造器
    构造器和说明
    `AbstractAdvisingBeanPostProcessor()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `customizeProxyFactory(ProxyFactory proxyFactory)` Subclasses may choose to implement this: for example, to change the interfaces exposed.
    `protected boolean` | `isEligible(Class<?> targetClass)` Check whether the given class is eligible for advising with this post-processor's `Advisor`.
    `protected boolean` | `isEligible(Object bean, String beanName)` Check whether the given bean is eligible for advising with this post-processor's `Advisor`.
    `Object` | `postProcessAfterInitialization(Object bean, String beanName)`
    `Object` | `postProcessBeforeInitialization(Object bean, String beanName)`
    `protected ProxyFactory` | `prepareProxyFactory(Object bean, String beanName)` Prepare a `ProxyFactory` for the given bean.
    `void` | `setBeforeExistingAdvisors(boolean beforeExistingAdvisors)` Set whether this post-processor's advisor is supposed to apply before existing advisors when encountering a pre-advised object.

    - ### 从类继承的方法 org.springframework.aop.framework.ProxyProcessorSupport

      `evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoader`

    - ### 从类继承的方法 org.springframework.aop.framework.ProxyConfig

      `copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 字段详细资料

    - #### advisor

          @Nullable
          protected Advisor advisor

    - #### beforeExistingAdvisors

          protected boolean beforeExistingAdvisors

  - ### 构造器详细资料

    - #### AbstractAdvisingBeanPostProcessor

          public AbstractAdvisingBeanPostProcessor()

  - ### 方法详细资料

    - #### setBeforeExistingAdvisors

          public void setBeforeExistingAdvisors(boolean beforeExistingAdvisors)

      Set whether this post-processor's advisor is supposed to apply before existing advisors when encountering a pre-advised object.

      Default is "false", applying the advisor after existing advisors, i.e. as close as possible to the target method. Switch this to "true" in order for this post-processor's advisor to wrap existing advisors as well.

      Note: Check the concrete post-processor's javadoc whether it possibly changes this flag by default, depending on the nature of its advisor.

    - #### postProcessBeforeInitialization

          public Object postProcessBeforeInitialization(Object bean,
                                                        String beanName)

      指定者:
        `postProcessBeforeInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`

    - #### postProcessAfterInitialization

          public Object postProcessAfterInitialization(Object bean,
                                                       String beanName)

      指定者:
        `postProcessAfterInitialization` 在接口中 `org.springframework.beans.factory.config.BeanPostProcessor`

    - #### isEligible

          protected boolean isEligible(Object bean,
                                       String beanName)

      Check whether the given bean is eligible for advising with this post-processor's `Advisor`.

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

      参数:
        `bean` - the bean instance
        `beanName` - the name of the bean
      另请参阅:
        `isEligible(Class)`

    - #### isEligible

          protected boolean isEligible(Class<?> targetClass)

      Check whether the given class is eligible for advising with this post-processor's `Advisor`.

      Implements caching of `canApply` results per bean target class.

      参数:
        `targetClass` - the class to check against
      另请参阅:
        `AopUtils.canApply(Advisor, Class)`

    - #### prepareProxyFactory

          protected ProxyFactory prepareProxyFactory(Object bean,
                                                     String beanName)

      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; `customizeProxyFactory(org.springframework.aop.framework.ProxyFactory)` allows for late customizations of those parts right before proxy creation.

      参数:
        `bean` - the bean instance to create a proxy for
        `beanName` - the corresponding bean name
      返回:
        the ProxyFactory, initialized with this processor's `ProxyConfig` settings and the specified bean
      从以下版本开始:
        4.2.3
      另请参阅:
        `customizeProxyFactory(org.springframework.aop.framework.ProxyFactory)`

    - #### customizeProxyFactory

          protected void customizeProxyFactory(ProxyFactory proxyFactory)

      Subclasses may choose to implement this: for example, to change the interfaces exposed.

      The default implementation is empty.

      参数:
        `proxyFactory` - the ProxyFactory that is already configured with target, advisor and interfaces and will be used to create the proxy immediately after this method returns
      从以下版本开始:
        4.2.3
      另请参阅:
        `prepareProxyFactory(java.lang.Object, java.lang.String)`