基于Schema配置的AOP
生活随笔
收集整理的這篇文章主要介紹了
基于Schema配置的AOP
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、切面配置
1 <aop:config proxy-target-class="true"> 2 <aop:pointcut id="pointcut" expression="target(NaiveWaiter) and execution(* greetTo(..))"/> 3 <aop:aspect ref="aspect"> 4 <aop:before method="before" pointcut-ref="pointcut"/> 5 </aop:aspect> 6 </aop:config> 7 8 <bean id="waiter" class="NaiveWaiter"/> 9 <bean id="aspect" class="PreGreetingAspect"/>proxy-target-class?為true時使用CGLib代理?false時使用JDK.?
環繞通知類需要注意
1 import org.aspectj.lang.ProceedingJoinPoint; 2 public class SurGreetingAspect { 3 public Object sur(ProceedingJoinPoint pjd)throws Throwable { 4 System.out.println("----------------"); 5 Object obj=pjd.proceed(); 6 7 return obj; 8 } 9 }?
轉載于:https://www.cnblogs.com/WutingjiaWill/p/7780802.html
總結
以上是生活随笔為你收集整理的基于Schema配置的AOP的全部內容,希望文章能夠幫你解決所遇到的問題。