spring 基于xml方式配置aop
生活随笔
收集整理的這篇文章主要介紹了
spring 基于xml方式配置aop
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
- 什么是aop
- 模擬aop
- 配置
什么是aop
2.aop關鍵概念
模擬aop
配置
<!-- 目標對象 --><bean id="target" class="com.lovely.proxy.aop.Target"></bean><!-- 切面對象 --><bean id="myAspect" class="com.lovely.proxy.aop.MyAspect"></bean><!-- aop配置 --><!-- 配置織入 被增強的方法(切點) 要進行那些增強(前置,后置) --><aop:config><!-- 聲明切面--><aop:aspect ref="myAspect"><!-- 切點表達式的抽取 --><aop:pointcut id="myPointcut" expression="execution(* com.lovely.proxy.aop.*.*(..))"/><!-- 切面:通知 + 切點 --><!--<aop:before method="before" pointcut="execution(public void com.lovely.proxy.aop.Target.save())"/>--><!-- 前后置通知 --><!--<aop:before method="before" pointcut="execution(void com.lovely.proxy.aop.*.*(..))"/><aop:after-returning method="afterReturning" pointcut="execution(void com.lovely.proxy.aop.*.*(..))"/>--><!-- 環繞增強 --><!--<aop:around method="around" pointcut="execution(* com.lovely.proxy.aop.*.*(..))"/>--><!-- 拋出異常通知 --><!--<aop:after-throwing method="afterThrowing" pointcut="execution(void com.lovely.proxy.aop.*.*(..))"/>--><!-- 最終通知 --><!--<aop:after method="after" pointcut="execution(void com.lovely.proxy.aop.*.*(..))"/>--><!-- 引用切點表達式 --><aop:around method="around" pointcut-ref="myPointcut"/></aop:aspect></aop:config>總結
以上是生活随笔為你收集整理的spring 基于xml方式配置aop的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么把mp3格式的音频文件转为文字?
- 下一篇: 基于mxnet的Regression问题