一、AOP 概念 M7-2;MZ
Joinpoint:它定义在哪里加入你的逻辑功能,对于Spring AOP,Jointpoint指的就是Method。 ?N@[R];
zH#urF6<
Advice:特定的Jointpoint处运行的代码,对于Spring AOP 来讲,有Before advice、AfterreturningAdvice、ThrowAdvice、AroundAdvice(MethodInteceptor)等。 5{v uN)K3
0h{&k7T<7
Pointcut:一组Joinpoint,就是说一个Advice可能在多个地方织入, GNHW bC6_m
OsRizcgdA
Aspect:这个我一直迷惑,它实际是Advice和Pointcut的组合,但是Spring AOP 中的Advisor也是这样一个东西,但是Spring中为什么叫Advisor而不叫做Aspect。 UgZL<}
N&|,!Cu
Weaving:将Aspect加入到程序代码的过程,对于Spring AOP,由ProxyFactory或者ProxyFactoryBean负责织入动作。 5ci1ce
T{=&>pNK[
Target:这个很容易理解,就是需要Aspect功能的对象。 6*
0vUy*"
1qm*#4x
Introduction:引入,就是向对象中加入新的属性或方法,一般是一个实例一个引用对象。当然如果不引入属性或者引入的属性做了线程安全性处理或者只读属性,则一个Class一个引用也是可以的(自己理解)。Per-class lifecycle or per-instance life cycle "3_GFq
c'5ls7?}O{
二、AOP 种类 1S yG
1、静态织入:指在编译时期就织入Aspect代码,AspectJ好像是这样做的。 :YLurng/]
O]j<