org.springframework.scheduling.annotation

## 类 AsyncAnnotationAdvisor

- java.lang.Object
- - org.springframework.aop.support.AbstractPointcutAdvisor
  - - org.springframework.scheduling.annotation.AsyncAnnotationAdvisor

- 所有已实现的接口:
    Serializable, org.springframework.aop.Advisor, org.springframework.aop.PointcutAdvisor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.core.Ordered

      public class AsyncAnnotationAdvisor
      extends org.springframework.aop.support.AbstractPointcutAdvisor
      implements org.springframework.beans.factory.BeanFactoryAware

  Advisor that activates asynchronous method execution through the `Async` annotation. This annotation can be used at the method and type level in implementation classes as well as in service interfaces.

  This advisor detects the EJB 3.1 `javax.ejb.Asynchronous` annotation as well, treating it exactly like Spring's own `Async`. Furthermore, a custom async annotation type may get specified through the `"asyncAnnotationType"` property.

  从以下版本开始:
    3.0
  作者:
    Juergen Hoeller
  另请参阅:
    `Async`, `AnnotationAsyncExecutionInterceptor`, 序列化表格

- - ### 字段概要

    - ### 从接口继承的字段 org.springframework.aop.Advisor

      `EMPTY_ADVICE`

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

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

    构造器
    构造器和说明
    `AsyncAnnotationAdvisor()` Create a new `AsyncAnnotationAdvisor` for bean-style configuration.
    `AsyncAnnotationAdvisor(Executor executor, org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)` Create a new `AsyncAnnotationAdvisor` for the given task executor.

  - ### 方法概要

    所有方法 实例方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected org.aopalliance.aop.Advice` | `buildAdvice(Executor executor, org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)`
    `protected org.springframework.aop.Pointcut` | `buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes)` Calculate a pointcut for the given async annotation types, if any.
    `org.aopalliance.aop.Advice` | `getAdvice()`
    `org.springframework.aop.Pointcut` | `getPointcut()`
    `void` | `setAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType)` Set the 'async' annotation type.
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)` Set the `BeanFactory` to be used when looking up executors by qualifier.
    `void` | `setTaskExecutor(Executor executor)` 已过时。 as of 5.0.8, in favor of `AsyncAnnotationAdvisor(Executor, AsyncUncaughtExceptionHandler)`

    - ### 从类继承的方法 org.springframework.aop.support.AbstractPointcutAdvisor

      `equals, getOrder, hashCode, isPerInstance, setOrder`

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

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### AsyncAnnotationAdvisor

          public AsyncAnnotationAdvisor()

      Create a new `AsyncAnnotationAdvisor` for bean-style configuration.

    - #### AsyncAnnotationAdvisor

          public AsyncAnnotationAdvisor(@Nullable
                                        Executor executor,
                                        @Nullable
                                        org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)

      Create a new `AsyncAnnotationAdvisor` for the given task executor.
      参数:
        `executor` - the task executor to use for asynchronous methods (can be `null` to trigger default executor resolution)
        `exceptionHandler` - the `AsyncUncaughtExceptionHandler` to use to handle unexpected exception thrown by asynchronous method executions
      另请参阅:
        `AsyncExecutionInterceptor.getDefaultExecutor(BeanFactory)`

  - ### 方法详细资料

    - #### setTaskExecutor

          @Deprecated
          public void setTaskExecutor(Executor executor)

      已过时。 as of 5.0.8, in favor of `AsyncAnnotationAdvisor(Executor, AsyncUncaughtExceptionHandler)`
      Specify the default task executor to use for asynchronous methods.

    - #### setAsyncAnnotationType

          public void setAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType)

      Set the 'async' annotation type.

      The default async annotation type is the `Async` annotation, as well as the EJB 3.1 `javax.ejb.Asynchronous` annotation (if present).

      This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate that a method is to be executed asynchronously.

      参数:
        `asyncAnnotationType` - the desired annotation type

    - #### setBeanFactory

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

      Set the `BeanFactory` to be used when looking up executors by qualifier.
      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`

    - #### getAdvice

          public org.aopalliance.aop.Advice getAdvice()

      指定者:
        `getAdvice` 在接口中 `org.springframework.aop.Advisor`

    - #### getPointcut

          public org.springframework.aop.Pointcut getPointcut()

      指定者:
        `getPointcut` 在接口中 `org.springframework.aop.PointcutAdvisor`

    - #### buildAdvice

          protected org.aopalliance.aop.Advice buildAdvice(@Nullable
                                                           Executor executor,
                                                           org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)

    - #### buildPointcut

          protected org.springframework.aop.Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes)

      Calculate a pointcut for the given async annotation types, if any.
      参数:
        `asyncAnnotationTypes` - the async annotation types to introspect
      返回:
        the applicable Pointcut object, or `null` if none