Polpid's World

[Spring In Action]정규표현식 포인트컷 선언 본문

Development/Java

[Spring In Action]정규표현식 포인트컷 선언

폴피드 2011.09.06 08:27
포인트컷은 어드바이스가 적용돼야할 메서드를 골라내는것

pointcut 정의
  1. <bean id="performancePointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut">
  2.     <prorperty name="pattern" value=".*perform">
  3. </prorperty></bean>
advice와 pointcut 결합
  1. <bean id="audienceAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
  2.     <prorperty name="advice" ref="audienceAdvice">
  3.     <prorperty name="pointcut" ref="performancePointcut">
  4. </prorperty></prorperty></bean>
하나의 빈 설정으로 pointcut과 advice 동시정의
  1. <bean id="audienceAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
  2.     <prorperty name="advice" ref="audienceAdvice">
  3.     <prorperty name="pointcut" ref=".*perform">
  4. </prorperty></prorperty></bean>


0 Comments
댓글쓰기 폼