1.execution
使用execution(方法表达式)匹配方法的执行。
2.within
用法:within(类型表达式)
目标对象target的类型是否和within中指定的类型匹配。
相当于:target.getClass().equals(within中指定的类型);
3.this
用法:this(类型全限定名)
通过aop创建的代理对象proxy的类型是否和this中指定的类型匹配;
this(x),相当于:x.getClass().isAssignableFrom(proxy.getClass());
4.target
用法:target(类型全限定名)
判断目标对象target的类型是否和指定的类型匹配;
target(x),相当于:x.getClass().isAssignableFrom(target.getClass());
5.args
用法:args(参数类型列表)
匹配执行的方法传入的参数类型(非方法签名的参数类型)是否为args中指定的一致;属于动态切入点(执行方法的时候进行判断),开销非常大。
6.@within
用法:@within(注解类型)
匹配包含@within中指定的注解的类定义的方法,例如:
@OK
public class UserModel {
private String name;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
可通过@within(OK)来匹配UserModel的内定义的方法(setName、getName)。
@within(X),相当于:被调用的目标方法Method对象.getDeclaringClass().getAnnotation(X.class) != null;
7.@target
用法:target(注解类型)
匹配目标对象target的类上有指定注解。
target(X),相当于:target.class.getAnnotation(X.class) != null;
8.@args
用法:@args(注解类型)
匹配方法参数所属类上(不是参数上)有指定的注解;
9.@annotation
用法:@annotation(注解类型)
匹配被调用的方法上有指定的注解。
10.bean
用法:bean(bean名称)
匹配spring容器中指定名称的bean。
11.reference pointcut
表示引用其他命名切入点。
12.组合型的pointcut
pointcut定义时,可以使用&&、||、!运算符。