blob: dad91da685af5ebcedf4b25094f0eb9fcb25eb47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import org.aspectj.lang.reflect.MethodSignature;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import java.lang.annotation.*;
public aspect AnnotationBinding {
pointcut callToABeanMethod(Bean beanAnnotation) :
call(@Bean * *(..)) && @annotation(beanAnnotation);
@SuppressAjWarnings
Object around(Bean beanAnnotation) : callToABeanMethod(beanAnnotation) {
return proceed(beanAnnotation);
}
public static void main(String[] args) {
D d = new D();
d.bar();
}
}
@Retention(RetentionPolicy.RUNTIME)
@interface Bean {
boolean issingleton() default true;
}
class C {
@Bean
public void foo() {}
}
class D extends C {
public void bar() { foo(); }
}
|