6.1.5 포인트 컷 수퍼 클래스 by ys

Spring은 자신 만의 pointcut을 구현하는 데 도움이되는 유용한 pointcut 수퍼 클래스를 제공한다.

정적 포인트컷이 가장 유용하므로 다음과 같이 StaticMethodMatcherPointcut의 하위 클래스를 만들 것이다. StaticMethodMatcherPointcut를 구현할 때는 딱 하나의 추상 메서드만 구현하면 된다.(동작을 수정하려고 다른 메서드를 오버라이드하는 것도 가능하지만)

class TestStaticPointcut extends StaticMethodMatcherPointcut {

    public boolean matches(Method m, Class targetClass) {
        // return true if custom criteria match
    }
}

동적 인 pointcut을위한 수퍼 클래스도 있습니다.

임의의 어드바이스 타입으로 사용자 정의 pointcut을 사용할 수 있습니다.

Last updated