Spring AOP学习(六)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd"> <!-- 配置 bean -->
<bean id="arithmeticCalculator"
class="com.atguigu.spring.aop.xml.ArithmeticCalculatorImpl"></bean> <!-- 配置切面的 bean. -->
<bean id="loggingAspect"
class="com.atguigu.spring.aop.xml.LoggingAspect"></bean> <bean id="vlidationAspect"
class="com.atguigu.spring.aop.xml.VlidationAspect"></bean> <!-- 配置 AOP -->
<aop:config>
<!-- 配置切点表达式 -->
<aop:pointcut expression="execution(* com.atguigu.spring.aop.xml.ArithmeticCalculator.*(int, int))"
id="pointcut"/>
<!-- 配置切面及通知 -->
<aop:aspect ref="loggingAspect" order="">
<aop:before method="beforeMethod" pointcut-ref="pointcut"/>
<aop:after method="afterMethod" pointcut-ref="pointcut"/>
<aop:after-throwing method="afterThrowing" pointcut-ref="pointcut" throwing="e"/>
<aop:after-returning method="afterReturning" pointcut-ref="pointcut" returning="result"/>
<!--
<aop:around method="aroundMethod" pointcut-ref="pointcut"/>
-->
</aop:aspect>
<aop:aspect ref="vlidationAspect" order="">
<aop:before method="validateArgs" pointcut-ref="pointcut"/>
</aop:aspect>
</aop:config>
</beans>
AOP xml形式的配置
Spring AOP学习(六)的更多相关文章
- Spring AOP 学习例子
http://outofmemory.cn/code-snippet/3762/Spring-AOP-learn-example 工作忙,时间紧,不过事情再多,学习是必须的.记得以前的部门老大 ...
- spring aop学习记录
许多AOP框架,比较常用的是Spring AOP 与AspectJ.这里主要学习的Spring AOP. 关于AOP 日志.事务.安全验证这些通用的.散步在系统各处的需要在实现业务逻辑时关注的事情称为 ...
- 在Intellij上面导入项目 & AOP示例项目 & AspectJ学习 & Spring AoP学习
为了学习这篇文章里面下载的代码:http://www.cnblogs.com/charlesblc/p/6083687.html 需要用Intellij导入一个已有工程.源文件原始内容也可见:link ...
- AOP和spring AOP学习记录
AOP基本概念的理解 面向切面AOP主要是在编译期或运行时,对程序进行织入,实现代理, 对原代码毫无侵入性,不破坏主要业务逻辑,减少程序的耦合度. 主要应用范围: 日志记录,性能统计,安全控制,事务处 ...
- Spring AOP学习笔记01:AOP概述
1. AOP概述 软件开发一直在寻求更加高效.更易维护甚至更易扩展的方式.为了提高开发效率,我们对开发使用的语言进行抽象,走过了从汇编时代到现在各种高级语言繁盛之时期:为了便于维护和扩展,我们对某些相 ...
- Spring AOP学习笔记02:如何开启AOP
上文简要总结了一些AOP的基本概念,并在此基础上叙述了Spring AOP的基本原理,并且辅以一个简单例子帮助理解.从本文开始,我们要开始深入到源码层面来一探Spring AOP魔法的原理了. 要使用 ...
- Spring AOP学习笔记03:AOP的核心实现之获取增强器
上文讲了spring是如何开启AOP的,简单点说就是将AnnotationAwareAspectJAutoProxyCreator这个类注册到容器中,因为这个类最终实现了BeanPostProcess ...
- Spring AOP学习笔记05:AOP失效的罪因
前面的文章中我们介绍了Spring AOP的简单使用,并从源码的角度学习了其底层的实现原理,有了这些基础之后,本文来讨论一下Spring AOP失效的问题,这个问题可能我们在平时工作中或多或少也会碰到 ...
- spring aop 学习1
1.配置自动扫描的包 <context:component-scan base-package="com.ddf.spring.aop.impl"/> 2.使用spri ...
随机推荐
- 函数bsxfun,两个数组间元素逐个计算的二值操作
转自http://www.cnblogs.com/rong86/p/3559616.html 函数功能:两个数组间元素逐个计算的二值操作 使用方法:C=bsxfun(fun,A,B) 两个数组A合B间 ...
- 佛祖保佑 永无bug 代码注释
// // _oo0oo_ // o8888888o // 88" . "88 // (| -_- |) // 0\ = /0 // ___/`---'\___ // .' \\| ...
- CodeForces 731C Socks (DFS或并查集)
题意:有n只袜子,k种颜色,在m天中,问最少修改几只袜子的颜色,可以使每天穿的袜子左右两只都同颜色. 析:很明显,每个连通块都必须是同一种颜色,然后再统计最多颜色的就好了,即可以用并查集也可以用DFS ...
- 10.24afternoon清北学堂刷题班
/* 这是什么题... */ #include<iostream> #include<cstdio> #include<cstring> #include<q ...
- HDU4947GCD Array(莫比乌斯反演+树状数组)
题面 传送门 题解 orz ljz 相当于每一个数要加上 \[v\times [\gcd(i,n)=d]=v\times [\gcd(i/d,n/d)=1]=v\times \sum_{p|{i\ov ...
- MvcPager 分页控件
官方教程: http://www.webdiyer.com/mvcpager
- [Usaco2005 oct]Flying Right 飞行航班
Description 为了表示不能输给人类,农场的奶牛们决定成立一家航空公司.她们计划每天早晨,从密歇根湖湖岸的最北端飞向最南端,晚上从最南端飞往最北端.在旅途中,航空公司可以安排飞机停在某些机场. ...
- 洛谷 P3389 【模板】高斯消元法
以下这个好像叫高斯约旦消元法,没有回代 https://www.luogu.org/blog/37781/solution-p3389 #include<cstdio> #include& ...
- [译]The multi Interface
The multi Interfacemulti接口 The easy interface as described in detail in this document is a synchrono ...
- MSSQLServer知识点总结:DDL(create,alter,drop,declare)-未完整
一.开发环境 Window10 二.开发工具 SQLServer2012 三.数据库的操作 1.创建 (1)方式一:使用默认的配置信息 create database T_mydb2 (2)方式二:自 ...