| 20 | } |
| 21 | |
| 22 | class 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 | |
| 41 | class MyClass { |
| 42 | @Transactional |
nothing calls this directly
no outgoing calls
no test coverage detected