(AspectJ를 주석과 함께 와일드 카드 표현으로, ..) 그것을 할 수있는 많은 방법 이 있습니다 내가 AspectJ를 함께 예를 줄 것이다
그래서 당신은을 표시 당신이 한 모든 설정입니다
class MyClass{
@MyPoint
public void save1(){
}
@MyPoint
public void save2(){
}
public void save3(){
}
public void save4(){
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyPoint {
}
@Aspect
@Component
public class MyAspect {
@Before("@annotation(com.xyz.MyPoint)")
public void before(JoinPoint joinPoint) throws Throwable {
//do here what u want
}
}
annotation, spring은이 메소드의 aspect 이전에 호출 할 것이고, 스프링이이 메소드와 객체를 관리하는지 확인해야한다. 클래스 경로에 AspectJ를 포함
Actally 또는 작동하지 않았다가, 사용했다 || 대신 실행 (* my.Class.myMethod (..)) || 실행 (* my.Class.myOtherMethod (..)) – Anand