Added test for custom async annotation

This commit is contained in:
Juergen Hoeller 2012-10-31 02:09:40 +01:00 committed by unknown
parent 0e0200769d
commit 69763fe249
2 changed files with 10 additions and 2 deletions

View File

@ -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 {

View File

@ -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 {