Annotation Interface Async
@Async
is not supported
on methods declared within a
@Configuration
class.
In terms of target method signatures, any parameter types are supported.
However, the return type is constrained to either void
or
Future
. In the latter case, you may declare the
more specific ListenableFuture
or
CompletableFuture
types which allow for richer
interaction with the asynchronous task and for immediate composition with
further processing steps.
A Future
handle returned from the proxy will be an actual asynchronous
Future
that can be used to track the result of the asynchronous method
execution. However, since the target method needs to implement the same signature,
it will have to return a temporary Future
handle that just passes a value
through: e.g. Spring's AsyncResult
, EJB 3.1's AsyncResult
,
or CompletableFuture.completedFuture(Object)
.
- Since:
- 3.0
- Author:
- Juergen Hoeller, Chris Beams
- See Also:
-
Optional Element Summary
-
Element Details
-
value
String valueA qualifier value for the specified asynchronous operation(s).May be used to determine the target executor to be used when executing the asynchronous operation(s), matching the qualifier value (or the bean name) of a specific
Executor
orTaskExecutor
bean definition.When specified on a class-level
@Async
annotation, indicates that the given executor should be used for all methods within the class. Method-level use ofAsync#value
always overrides any value set at the class level.- Since:
- 3.1.2
- Default:
- ""
-