Class AsyncAnnotationBeanPostProcessor

All Implemented Interfaces:
Serializable, AopInfrastructureBean, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanPostProcessor, Ordered

public class AsyncAnnotationBeanPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor
Bean post-processor that automatically applies asynchronous invocation behavior to any bean that carries the Async annotation at class or method-level by adding a corresponding AsyncAnnotationAdvisor to the exposed proxy (either an existing AOP proxy or a newly generated proxy that implements all the target's interfaces).

The TaskExecutor responsible for the asynchronous execution may be provided as well as the annotation type that indicates a method should be invoked asynchronously. If no annotation type is specified, this post- processor will detect both Spring's @Async annotation as well as the EJB 3.1 jakarta.ejb.Asynchronous annotation.

For methods having a void return type, any exception thrown during the asynchronous method invocation cannot be accessed by the caller. An AsyncUncaughtExceptionHandler can be specified to handle these cases.

Note: The underlying async advisor applies before existing advisors by default, in order to switch to async execution as early as possible in the invocation chain.

Since:
3.0
Author:
Mark Fisher, Juergen Hoeller, Stephane Nicoll
See Also:
  • Field Details

  • Constructor Details

    • AsyncAnnotationBeanPostProcessor

      public AsyncAnnotationBeanPostProcessor()
  • Method Details