4 spring AOP (spring 2.0 技术手册)
spring2.0 提供三种AOP实现方式:
1. spring1.2前版本, 实现AOP的接口,在xml配置。
2. spring2.0 <aop>标签,不用实现接口
3. @AspectJ的Annotation支持 JDK5.0
?
advices:
MethodBeforeAdvice (before advice)
AfterReturningAdvice (after advice)
MethodInterceptor??? (around advice)???? aopalliance 提供的接口
ThowsAdvice???????????? (thorw advice)??????? 标签接口
?
pointcut : 定义了感兴趣的jointPoint,每个pointcut都有相对应的PointcutAdvisor
?
NameMatchMethodPointcutAdvisor? *可以用来代替字符串
RegExpMethodPointcutAdvisor 正则表达式
ControlFlowPointcut?? 动态的Pointcut
?
pointcut接口
public interface Pointcut{ Classfilter getClassFilter(); //决定类是否要运用advice MethodMather getMehodMatcher(); //某个方法是否要运用advice Pointcut TRUE = TruePointcut.INSTANCE;}Pointcut 交集、并集操作。
?
Introduction (特殊的advice)
对已有类添加一些额外的方法。(不改变已有类)