blob: 1cc1ea49bc63700bcbdaa8aa0fd0ee4adada2115 (
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
38
39
|
import org.aspectj.lang.annotation.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
import org.aspectj.lang.*;
@Aspect("perthis(transactional())")
public class Code2 {
@Pointcut("execution(@Transactional * * (..))")
public void transactional() { }
@Before("execution(* *(..))")
public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
System.out.println(thisJoinPointStaticPart);
}
public static void main(String[] args) {
new AAA().m();
new BBB().m();
new CCC().m();
}
}
class AAA {
public void m() { }
}
class BBB {
public void m() { }
}
class CCC {
@Transactional
public void m() { }
}
@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
|