2009년 10월 7일 수요일

[AOP] pointcut을 이용한 parameter 전달 메소드 실행

<aop:config>
    <aop:aspect id="beanServiceAspect" ref="beanService">
        <aop:after                
             method="insertMethod"
             pointcut="execution(public * package.UseController.method(..)) and args(arg1, ..)" />
    </aop:aspect>
</aop:config>

UseController 의 method() 가 호출되고 나면 beanService에 정의된 insertMethod() 가 실행된다.

이때 insertMethod() 의 argument 인 arg1은 method()이 호출될 당시의 값으로 전달받는다.

댓글 없음:

댓글 쓰기