Skip to content

Commit ab232a5

Browse files
committed
Polish EnableAsync javadoc
Issue: SPR-14793
1 parent 1f6f0dc commit ab232a5

File tree

1 file changed

+12
-10
lines changed
  • spring-context/src/main/java/org/springframework/scheduling/annotation

1 file changed

+12
-10
lines changed

spring-context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,23 @@
3232
* Enables Spring's asynchronous method execution capability, similar to functionality
3333
* found in Spring's {@code <task:*>} XML namespace.
3434
*
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.
39-
*
35+
* <p>To be used together with @{@link Configuration Configuration} classes as follows:
4036
* <pre class="code">
4137
* &#064;Configuration
4238
* &#064;EnableAsync
4339
* public class AppConfig {
4440
*
41+
* }</pre>
42+
*
43+
* {@code MyAsyncBean} is a user-defined type with one or more methods annotated with
44+
* either Spring's {@code @Async} annotation, the EJB 3.1 {@code @javax.ejb.Asynchronous}
45+
* annotation, or any custom annotation specified via the {@link #annotation} attribute.
46+
* The aspect is added transparently for any registered bean, for instance via this
47+
* configuration:
48+
* <pre class="code">
49+
* &#064;Configuration
50+
* public class AnotherAppConfig {
51+
*
4552
* &#064;Bean
4653
* public MyAsyncBean asyncBean() {
4754
* return new MyAsyncBean();
@@ -79,11 +86,6 @@
7986
* &#064;EnableAsync
8087
* public class AppConfig implements AsyncConfigurer {
8188
*
82-
* &#064;Bean
83-
* public MyAsyncBean asyncBean() {
84-
* return new MyAsyncBean();
85-
* }
86-
*
8789
* &#064;Override
8890
* public Executor getAsyncExecutor() {
8991
* ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();

0 commit comments

Comments
 (0)