Header

  1. View current page

    정상혁의 수첩

Profile_img_60x60_08
195

Spring AOP namespace 예제

 

Spring 2.0의 AOP

 

Pointcut 식 예제

<aop:config>
      <aop:advisor
         pointcut="execution(public * com.benelog.server..*.*BO.*(..))"
         advice-ref="txAdvice"/>
</aop:config>
<aop:config>
     <aop: id="logginAspect" ref="logAdvice">
       <aop:before method="doBasicLogging"   
             pointcut="execution(public * com.benelog.server..*.*BO.*(..))"/>
     </aop:aspect>
</aop:config>

 

<aop:config>

  <aop:pointcut id="servicePointcut" expression="execution(* *..*Service.*(..))"/>

  <aop:aspect id="loggingAspect" ref="logging">

     <aop around pointcut-ref="servicePointcut" method="logging"/>

  </aop:aspect>

</aop:config>

 

aop:before

aop:after-returning

aop:after-throwing

aop:after

aop:around

 

          <bean id="logAdvice" class="com.nhncorp.intostatic.common.ProcessorLogAdvice" />
          

execution(public void set*(..)) : 리턴 타입이 void이고 메소드 이름이 set으로 시작되고 파라미터가 0개 이상인 메소드

execution(* com.benelog.ftpserver.*.*() : com.benelog.ftpserver패키지의 파라미터가 없는 모든 메소드

execution(String com.benelog.ftpserver..*.*(..) : 리턴타입이 String이면서 com.benelog.ftpserver패키지 및 하위 패키지에 있는 파라미터가 0개 이상인 메소드

execution(String com.benelog.ftpserver.Server.insert(..) : 리턴타입이 String인 com.benelog.intostatic.ftpserver.Server의 파라미터가 0개 이상인 메소드

execution(* get*(*)) : get으로 이름이 시작하고 1개의 파라미터를 갖는 메소드

execution(* get*(*,*)) : get으로 이름이 시작하고 2개의 파라미터를 갖는 메소드 exceution(* read*(Interger,...)) : read로 이름이 시작하고, 첫번째 파라미터 타입이 Integer이며, 1개 이상의 파라미터를 갖는 메소드

History

Last edited on 11/02/2010 20:31 by benelog

Comments (0)

You must log in to leave a comment. Please sign in.