File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
main/java/org/springframework/scheduling/annotation
test/java/org/springframework/scheduling/annotation Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 42
42
* @see AnnotationAsyncExecutionInterceptor
43
43
* @see AsyncAnnotationAdvisor
44
44
*/
45
- @ Target ({ElementType .TYPE , ElementType .METHOD })
45
+ @ Target ({ElementType .METHOD , ElementType .TYPE })
46
46
@ Retention (RetentionPolicy .RUNTIME )
47
47
@ Documented
48
48
public @interface Async {
Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .scheduling .annotation ;
18
18
19
+ import java .lang .annotation .Retention ;
20
+ import java .lang .annotation .RetentionPolicy ;
19
21
import java .util .concurrent .Future ;
20
22
21
23
import org .junit .Test ;
@@ -200,7 +202,7 @@ public void doSomething(int i) {
200
202
assertTrue (Thread .currentThread ().getName ().startsWith ("e1-" ));
201
203
}
202
204
203
- @ Async ( "e2" )
205
+ @ MyAsync
204
206
public Future <String > returnSomething (int i ) {
205
207
assertTrue (!Thread .currentThread ().getName ().equals (originalThreadName ));
206
208
assertTrue (Thread .currentThread ().getName ().startsWith ("e2-" ));
@@ -215,6 +217,12 @@ public Future<String> returnSomething2(int i) {
215
217
}
216
218
217
219
220
+ @ Async ("e2" )
221
+ @ Retention (RetentionPolicy .RUNTIME )
222
+ public @interface MyAsync {
223
+ }
224
+
225
+
218
226
@ Async
219
227
public static class AsyncClassBean {
220
228
You can’t perform that action at this time.
0 commit comments