2017-01-04 10 views
0

내 모든 응용 프로그램 방식에서 실행이 AOP를 가지고,하지만 난 그게 해당 ProfileExecution 주석과 주석 방법을 실행하려면, 나는이 XML스프링 AOP 유일한 방법

<bean id="profiler" class="com.mytest.ProfilerExecution" /> 


<aop:config> 
    <aop:aspect ref="profiler"> 

     <aop:pointcut id="serviceMethod" 
      expression="execution(public * *(..))" /> 
      <aop:around pointcut-ref="serviceMethod" method="profile"/> 
    </aop:aspect> 
</aop:config> 
를 사용하여 할 수있는 방법

감사합니다.

답변

1

@annotation(com.abc.xyz.ProfileExecution)을 사용하여 AND 작업을 필터링하여 메서드를 필터링하십시오.

그래서 최종 XML은 그렇지가 작동하지 않습니다 표현 주석의 완전한 이름을 포함해야합니다

<aop:config> 
    <aop:aspect ref="profiler"> 
     <aop:pointcut id="serviceMethod" 
      expression="execution(public * *(..)) and @annotation(com.abc.xyz.ProfileExecution)" /> 
     <aop:around pointcut-ref="serviceMethod" method="profile"/> 
    </aop:aspect> 
</aop:config> 

아래처럼 보일 것입니다.