diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java index e4910e9f1b9..8b7eb4c0262 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java @@ -32,16 +32,26 @@ import org.springframework.core.Ordered; * Enables Spring's asynchronous method execution capability, similar to functionality * found in Spring's {@code } XML namespace. * - *

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. + *

To be used together with @{@link Configuration Configuration} classes as follows, + * enabling annotation-driven async processing for an entire Spring application context: * *

  * @Configuration
  * @EnableAsync
  * public class AppConfig {
  *
+ * }
+ * + * {@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: + * + *
+ * @Configuration
+ * public class AnotherAppConfig {
+ *
  *     @Bean
  *     public MyAsyncBean asyncBean() {
  *         return new MyAsyncBean();
@@ -79,11 +89,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();