网站建设程序文件,公司比较好,视觉设计和ui设计有什么区别,如何把网页做成响应式的项目场景#xff1a;
这里主要说下Spring Boot AOP中Pointcut拦截类上面的注解与方法上面的注解#xff0c;怎么写表达式怎么#xff0c;还有Pointcut中使用运算符。 PointCut 表达式 拦截注解的表达式有3种#xff1a;annotation、within、target 1、annotation
匹配有…项目场景
这里主要说下Spring Boot AOP中Pointcut拦截类上面的注解与方法上面的注解怎么写表达式怎么还有Pointcut中使用运算符。 PointCut 表达式 拦截注解的表达式有3种annotation、within、target 1、annotation
匹配有指定注解的方法注解作用在方法上面
annotation(com.test.aop.demo.MyAnnotation)
2、within
匹配包含某个注解的类注解作用在类上面
within(com.test.aop.demo.MyAnnotation)
3、target
匹配目标对象有指定注解的类注解作用在类上面
target(com.test.aop.demo.MyAnnotation) target 和within的区别 1、target(注解A)判断被调用的目标对象中是否声明了注解A如果有会被拦截 2、within(注解A) 判断被调用的方法所属的类中是否声明了注解A如果有会被拦截 3、target关注的是被调用的对象within关注的是调用的方法所在的类 PointCut中的运算符 PointCut中可以使用、||、! 运算符 同时匹配方法上的和类上的注解
Pointcut(annotation(com.test.aop.demo.MyAnnotation) || within(com.test.aop.demo.MyAnnotation))
public void cutController(){
}或者
Pointcut(annotation(com.test.aop.demo.MyAnnotation))
public void cutController(){
}Pointcut(within(com.test.aop.demo.MyAnnotation))
public void cutService(){
}Pointcut(cutController() || cutService())
public void cutAll(){
}