MCPcopy Create free account
hub / github.com/castello/spring_basic / MyAdvice

Class MyAdvice

ch3/AopMain.java:22–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22class MyAdvice {
23 Pattern p = Pattern.compile("a.*");
24
25 boolean matches(Method m){
26 Matcher matcher = p.matcher(m.getName());
27 return matcher.matches();
28 }
29
30 void invoke(Method m, Object obj, Object... args) throws Exception {
31 if(m.getAnnotation(Transactional.class)!=null)
32 System.out.println("[before]{");
33
34 m.invoke(obj, args); // aaa(), aaa2(), bbb() 호출가능
35
36 if(m.getAnnotation(Transactional.class)!=null)
37 System.out.println("}[after]");
38 }
39}
40
41class MyClass {
42 @Transactional

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected