|
|
|
|
@ -32,16 +32,23 @@ import org.springframework.core.Ordered;
@@ -32,16 +32,23 @@ import org.springframework.core.Ordered;
|
|
|
|
|
* Enables Spring's asynchronous method execution capability, similar to functionality |
|
|
|
|
* found in Spring's {@code <task:*>} XML namespace. |
|
|
|
|
* |
|
|
|
|
* <p>To be used on @{@link Configuration} classes as follows, where {@code MyAsyncBean} |
|
|
|
|
* is a user-defined type with one or more methods annotated with either Spring's |
|
|
|
|
* {@code @Async} annotation, the EJB 3.1 {@code @javax.ejb.Asynchronous} annotation, |
|
|
|
|
* or any custom annotation specified via the {@link #annotation} attribute. |
|
|
|
|
* |
|
|
|
|
* <p>To be used together with @{@link Configuration Configuration} classes as follows: |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* @Configuration |
|
|
|
|
* @EnableAsync |
|
|
|
|
* public class AppConfig { |
|
|
|
|
* |
|
|
|
|
* }</pre> |
|
|
|
|
* |
|
|
|
|
* {@code MyAsyncBean} is a user-defined type with one or more methods annotated with |
|
|
|
|
* either Spring's {@code @Async} annotation, the EJB 3.1 {@code @javax.ejb.Asynchronous} |
|
|
|
|
* annotation, or any custom annotation specified via the {@link #annotation} attribute. |
|
|
|
|
* The aspect is added transparently for any registered bean, for instance via this |
|
|
|
|
* configuration: |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* @Configuration |
|
|
|
|
* public class AnotherAppConfig { |
|
|
|
|
* |
|
|
|
|
* @Bean |
|
|
|
|
* public MyAsyncBean asyncBean() { |
|
|
|
|
* return new MyAsyncBean(); |
|
|
|
|
@ -79,11 +86,6 @@ import org.springframework.core.Ordered;
@@ -79,11 +86,6 @@ import org.springframework.core.Ordered;
|
|
|
|
|
* @EnableAsync |
|
|
|
|
* public class AppConfig implements AsyncConfigurer { |
|
|
|
|
* |
|
|
|
|
* @Bean |
|
|
|
|
* public MyAsyncBean asyncBean() { |
|
|
|
|
* return new MyAsyncBean(); |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* @Override |
|
|
|
|
* public Executor getAsyncExecutor() { |
|
|
|
|
* ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
|
|
|
|
|