public class AsyncAnnotationAdvisor
extends org.springframework.aop.support.AbstractPointcutAdvisor
implements org.springframework.beans.factory.BeanFactoryAware
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.
Async
,
AnnotationAsyncExecutionInterceptor
,
Serialized FormConstructor and Description |
---|
AsyncAnnotationAdvisor()
Create a new
AsyncAnnotationAdvisor for bean-style configuration. |
AsyncAnnotationAdvisor(java.util.concurrent.Executor executor,
org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)
Create a new
AsyncAnnotationAdvisor for the given task executor. |
Modifier and Type | Method and Description |
---|---|
protected org.aopalliance.aop.Advice |
buildAdvice(java.util.concurrent.Executor executor,
org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler) |
protected org.springframework.aop.Pointcut |
buildPointcut(java.util.Set<java.lang.Class<? extends java.lang.annotation.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(java.lang.Class<? extends java.lang.annotation.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(java.util.concurrent.Executor executor)
Deprecated.
as of 5.0.8, in favor of
AsyncAnnotationAdvisor(Executor, AsyncUncaughtExceptionHandler) |
public AsyncAnnotationAdvisor()
AsyncAnnotationAdvisor
for bean-style configuration.public AsyncAnnotationAdvisor(@Nullable java.util.concurrent.Executor executor, @Nullable org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)
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 executionsAsyncExecutionInterceptor.getDefaultExecutor(BeanFactory)
@Deprecated public void setTaskExecutor(java.util.concurrent.Executor executor)
AsyncAnnotationAdvisor(Executor, AsyncUncaughtExceptionHandler)
public void setAsyncAnnotationType(java.lang.Class<? extends java.lang.annotation.Annotation> asyncAnnotationType)
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 typepublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
BeanFactory
to be used when looking up executors by qualifier.setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
public org.aopalliance.aop.Advice getAdvice()
getAdvice
in interface org.springframework.aop.Advisor
public org.springframework.aop.Pointcut getPointcut()
getPointcut
in interface org.springframework.aop.PointcutAdvisor
protected org.aopalliance.aop.Advice buildAdvice(@Nullable java.util.concurrent.Executor executor, org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler exceptionHandler)
protected org.springframework.aop.Pointcut buildPointcut(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> asyncAnnotationTypes)
asyncAnnotationTypes
- the async annotation types to introspectnull
if none