|
32 | 32 | * Enables Spring's asynchronous method execution capability, similar to functionality
|
33 | 33 | * found in Spring's {@code <task:*>} XML namespace.
|
34 | 34 | *
|
35 |
| - * <p>To be used on @{@link Configuration} classes as follows, where {@code MyAsyncBean} |
36 |
| - * is a user-defined type with one or more methods annotated with either Spring's |
37 |
| - * {@code @Async} annotation, the EJB 3.1 {@code @javax.ejb.Asynchronous} annotation, |
38 |
| - * or any custom annotation specified via the {@link #annotation} attribute. |
| 35 | + * <p>To be used together with @{@link Configuration Configuration} classes as follows, |
| 36 | + * enabling annotation-driven async processing for an entire Spring application context: |
39 | 37 | *
|
40 | 38 | * <pre class="code">
|
41 | 39 | * @Configuration
|
42 | 40 | * @EnableAsync
|
43 | 41 | * public class AppConfig {
|
44 | 42 | *
|
| 43 | + * }</pre> |
| 44 | + * |
| 45 | + * {@code MyAsyncBean} is a user-defined type with one or more methods annotated with |
| 46 | + * either Spring's {@code @Async} annotation, the EJB 3.1 {@code @javax.ejb.Asynchronous} |
| 47 | + * annotation, or any custom annotation specified via the {@link #annotation} attribute. |
| 48 | + * The aspect is added transparently for any registered bean, for instance via this |
| 49 | + * configuration: |
| 50 | + * |
| 51 | + * <pre class="code"> |
| 52 | + * @Configuration |
| 53 | + * public class AnotherAppConfig { |
| 54 | + * |
45 | 55 | * @Bean
|
46 | 56 | * public MyAsyncBean asyncBean() {
|
47 | 57 | * return new MyAsyncBean();
|
|
79 | 89 | * @EnableAsync
|
80 | 90 | * public class AppConfig implements AsyncConfigurer {
|
81 | 91 | *
|
82 |
| - * @Bean |
83 |
| - * public MyAsyncBean asyncBean() { |
84 |
| - * return new MyAsyncBean(); |
85 |
| - * } |
86 |
| - * |
87 | 92 | * @Override
|
88 | 93 | * public Executor getAsyncExecutor() {
|
89 | 94 | * ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
0 commit comments