Spring4.0学习笔记009——AOP的配置(基于XML文件)
来源:互联网 发布:2016 前端 grunt 知乎 编辑:程序博客网 时间:2024/06/05 00:37
还是借用上一篇博文的那些示例文件,但是需要先将之前那些文件的所有Spring注解都给删掉。
修改之前的xml配置文件。
<!-- 配置Bean --><bean id="arithmeticCalculator" class="com.yfyzwr.spring.aop.ArithmeticCalculatorImpl"></bean><!-- 配置切面的Bean --><bean id="loggingAspect" class="com.yfyzwr.spring.aop.LoggingAspect"></bean><!-- 配置AOP --><aop:config> <aop:pointcut expression="execution(* com.yfyzwr.spring.aop.*.*(..))" id="pointcut"/> <!-- 配置切面及通知 --> <aop:aspect ref="loggingAspect" order="0"> <aop:before method="beforeMerhod" pointcut-ref="pointcut"/> <aop:after method="afterMerhod" pointcut-ref="pointcut"/> <!-- 如果返回通知方法有表示返回值的参数,那么此处必须配置returning属性,并且returning属性的值还要与参数名称一致 --> <aop:after-returning method="returnMerhod" pointcut-ref="pointcut" returning="result"/> <!-- 如果异常通知方法有表示异常的参数,那么此处必须配置throwing属性,并且throwing属性的值还要与参数名称一致 --> <aop:after-throwing method="throwingMerhod" pointcut-ref="pointcut" throwing="ex"/> </aop:aspect></aop:config>
如果对于前一篇博文的基于注解来配置AOP已经了解的话,那么上述的xml配置是非常清晰明了的。
0 0
- Spring4.0学习笔记009——AOP的配置(基于XML文件)
- Spring4.0学习笔记003——Bean的配置一(基于XML文件)
- Spring4.0学习笔记004——Bean的配置二(基于XML文件)
- Spring4.0学习笔记005——Bean的配置三(基于XML文件)
- Spring4.0学习笔记008——AOP的配置(基于注解)
- 基于 xml 来配置 AOP -佟刚老师《Spring4视频教程》学习笔记(22)
- Spring4学习笔记-AOP(基于注解的方式)
- Spring4学习笔记-AOP(基于配置文件的方式)
- Spring4.0学习笔记006——Bean的配置(基于注解)
- Spring4 学习笔记(3)-Spring 基于 XML 的方式配置 Bean(供自己学习)
- Spring4笔记----用基于 XML 的AOP配
- Spring4 学习笔记(3)-Spring 基于 XML 的方式配置 Bean
- Spring4.0学习笔记--AOP
- Spring4.0学习笔记-AOP
- Spring4学习笔记-AOP
- Spring4.3.x 浅析xml配置的解析过程(9)——解析aop命名空间之config标签
- Spring Aop(七)——基于XML配置的Spring Aop
- Spring4深入理解AOP02----AOP简介,AspectJ,AOP基于注解和XML配置(5种通知,切面优先级)
- 假如时光可以倒流我要如何选择
- OpenCV人脸识别C++源码分析
- zabbix避免瞬时触发频繁报警
- 不存在插入的一种写法
- Install caffe Some questions--in ubuntu 14.04
- Spring4.0学习笔记009——AOP的配置(基于XML文件)
- Android Gson解析
- Python中列表的append操作比insert操作效率高的实质
- Solr4.10使用教程(三):solr crud
- 先ORDER BY再GROUP BY问题
- Linux内核的进程、线程问题
- Java synchronized详解
- Windows/Linux下引用jar包,并用javac/java编译运行
- 20. Valid Parentheses