AOP 切面编程学习笔记
2016-01-23 19:10
141 查看
介绍: aop.aspect这个包里面放的是切面类,这是一个关注点(共同业务)的模块化,这个关注点可能会横切多个对象
aop.service这个包里面放的是被切面横切的目标,EmpService Deptservice
aop-beans是配置文件,里面有bean的配置,切入点(切入点里面有一个表达式,可以判断哪些方法需要切入)的配置,通知(判断切入到哪里,执行什么方法)等。
测试类
aop.service这个包里面放的是被切面横切的目标,EmpService Deptservice
aop-beans是配置文件,里面有bean的配置,切入点(切入点里面有一个表达式,可以判断哪些方法需要切入)的配置,通知(判断切入到哪里,执行什么方法)等。
package test; import he.bean.PersonAction; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import aop.service.DeptService; import aop.service.DeptServiceImpl; import aop.service.EmpService; public class TestAll { @Test public void testPersonAction(){ AbstractApplicationContext ac = new ClassPathXmlApplicationContext("aop-beans.xml"); DeptService deptService = (DeptService) ac.getBean("deptService"); deptService.save(); //EmpService empService = (EmpService) ac.getBean("empService"); //empService.delete(); } }
测试类
相关文章推荐
- Springmvc学习笔记(4)之复杂参数类型绑定、校验、数据回显和异常处理
- C++学习笔记(二) bool const 和 #define 结构体内存对齐
- 关于在eclipse中创建servlet
- [Java 并发] Java并发编程实践 思维导图 - 第二章 线程安全性
- java中有三种移位运算符
- eclipse Hibernate Tools插件错误:Fetching children of Database
- 记问题排查:java进程未正常退出
- Java中 "abc" + '/'和"abc" + "/"的区别
- 编程学习笔记之c++相关::模板元的学习
- XAMPP安装错误解决
- [Leetcode]91. Decode Ways@python
- 编写直观的代码——单一职责原则
- C++ memcpy()函数用法
- 【MOOC】Java语言程序设计进阶—第0周
- C++ static关键字
- Qt动画与Qt坐标小记
- LayoutParams,setContentView,generateDefaultLayoutParams
- NetBeans找不到C/C++编译器
- C语言:运行中获取宏名字的技巧
- 变形空间和候选消除算法(Candidate-Elimination)C++实现