【Spring-AOP-1】AOP相关概念
2016-06-13 16:02
477 查看
Advice
(好多中文书籍翻译为:增强处理,比如前向增强、后向增强等)描述了Aspect类执行的具体动作。the job of an aspect.定义了如下两个方面:what:即Aspect类具体的功能;when:功能作用的时间点;
在spring中,when包括5个:
Join Points
A join point is a point in the execution of the application where an aspect can be plugged in.This point could be a method being called, an exception being thrown, or even a field being modified.程序中可以有很多个join point,这些连接点可以是方法调用、异常抛出、以及域修改等。这些都是在程序运行时的某个点。
Pointcuts
pointcut定义了advice需要在哪些join points进行织入。pointcuts define which join points get advised.可以简单理解为若干join point的集合,advice会在这些join points进行织入。If advice defines the what and when of aspects, then pointcuts define the where。
A pointcut definition matches one or more join points at which advice should be woven.
Aspect
An aspect is the merger of advice and pointcuts。Aspect是advice和pointcuts的组合。
Introduction
An introduction allows you to add new methods or attributes to existing classes。允许在已经存在的类中,添加新的方法和属性;
WEAVING
Weaving is the process of applying aspects to a target object to create a new proxied object。主要有3种织入方式:Compile time:AspectJ使用这种方式;Class load time:AspectJ使用这种方式;
Runtime:Spring支持的方式;
Spring对AOP的支持
spring AOP基于动态的代理实现,局限于对方法的拦截。
SPRING ADVICE IS WRITTEN IN JAVA :所有的advice都使用Java编写,pointcut可使用XML或annotation;
SPRING ADVISES OBJECTS AT RUNTIME:在运行时织入advice;
SPRING ONLY SUPPORTS METHOD JOIN POINTS:仅支持方法的join point;
来自为知笔记(Wiz)
相关文章推荐
- Java对存储过程的调用方法
- RxJava操作符(07-辅助操作)
- springMvc+maven中整合junit
- RxJava操作符(07-辅助操作)
- SpringMVC教程(二)hibernate关联关系注解
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- java的一些知识(二)
- 今天提示myeclipse subscription expiration,如何手动获取MyEclipse 注册码!很牛!
- java的一些知识(一)
- Spring之IoC容器解析(一)
- Java 7 数值字面量的改进
- java并发包java.util.concurrent
- 深入Java集合:LinkedHashMap实现原理
- RxJava操作符(06-错误处理)
- RxJava操作符(06-错误处理)
- Java编程思想21.2.1实例
- IntelIj 使用
- 了解Spring AOP
- JAVA模板方法
- Java金额数字转中文大写