Added test for custom async annotation
This commit is contained in:
parent
0e0200769d
commit
69763fe249
|
@ -42,7 +42,7 @@ import java.lang.annotation.Target;
|
|||
* @see AnnotationAsyncExecutionInterceptor
|
||||
* @see AsyncAnnotationAdvisor
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Async {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.scheduling.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -200,7 +202,7 @@ public class AsyncExecutionTests {
|
|||
assertTrue(Thread.currentThread().getName().startsWith("e1-"));
|
||||
}
|
||||
|
||||
@Async("e2")
|
||||
@MyAsync
|
||||
public Future<String> returnSomething(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
assertTrue(Thread.currentThread().getName().startsWith("e2-"));
|
||||
|
@ -215,6 +217,12 @@ public class AsyncExecutionTests {
|
|||
}
|
||||
|
||||
|
||||
@Async("e2")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MyAsync {
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public static class AsyncClassBean {
|
||||
|
||||
|
|
Loading…
Reference in New Issue