Pointcut注解表达式@target、@annotation、@within、this、target、within等
至于最常见的 execution表达式;由于网上一搜基本都是用的这个,这里就不在赘述了;这里将我知道的分享给大家;
//@Around("@annotation(自定义注解)")//自定义注解标注在方法上的方法执行aop方法
如:@Around("@annotation(org.springframework.transaction.annotation.Transactional)")
//@Around("@within(自定义注解)")//自定义注解标注在的类上;该类的所有方法(不包含子类方法)执行aop方法
如:@Around("@within(org.springframework.transaction.annotation.Transactional)")
//@Around("within(包名前缀.*)")//com.aop.within包下所有类的所有的方法都会执行(不包含子包) aop方法
如:@Around("within(com.aop.test.*)")
//@Around("within(包名前缀..*)")//com.aop.within包下所有的方法都会执行(包含子包)aop 方法
如:@Around("within(com.aop.test..*)")
//@Around("this(java类或接口)")//实现了该接口的类、继承该类、该类本身的类---的所有方法(包括不是接口定义的方法,但不包含父类的方法)都会执行aop方法
如:@Around("this(com.aop.service.TestService)")
//@Around("target(java类或接口)")//实现了该接口的类、继承该类、该类本身的类---的所有方法(包括不是接口定义的方法,包含父类的方法)
如:@Around("this(com.aop.service.TestService)")
//@Around("@target(自定义注解)")//springboot项目启动报如下错误,没有解决
// Caused by: java.lang.IllegalStateException:
// StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
目前分享到这里了!
————————————————
版权声明:本文为CSDN博主「scos_sxb」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/scos_sxb/article/details/100945389
DkAnnotation是注解
/**2 * @author 戴着假发的程序员3 * 4 * @description5 */6 @Component //将当前bean交给spring管理7 @Aspect //定义为一个AspectBean8 public class DkAspect {9 //使用@within配置匹配所有还有指定注解的方法 10 @Pointcut("@within(com.st.dk.demo7.annotations.DkAnnotation)") 11 private void pointCut1(){}12 //定义一个前置通知 13 @Before("pointCut1()") 14 private static void befor(){ 15 System.out.println("---前置通知---"); 16 } 17 }
Pointcut注解表达式@target、@annotation、@within、this、target、within等相关推荐
- @Pointcut注解表达式介绍
1 表达式类型 标准的Aspectj Aop的pointcut的表达式类型是很丰富的,但是Spring Aop只支持其中的9种,外加Spring Aop自己扩充的一种一共是10种类型的表达式,分别如下 ...
- spring aop中使用@Pointcut注解抽取可重用的切入点表达式
针对同一个切入点,如果有多个通知方法将切入时,通常我们需要标注多个注解,每个注解需要使用切入点表达式,告诉spring,当前通知方法在何时执行.当一个切入点需要更改时,就需要同时更改多个.为了避免这种 ...
- @Pointcut()的execution、@annotation等参数说明
AOP的基本概念 Advice(通知.切面): 某个连接点所采用的处理逻辑,也就是向连接点注入的代码, AOP在特定的切入点上执行的增强处理. @Before: 标识一个前置增强方法,相当于Befor ...
- Spring AOP中@Pointcut切入点表达式详解
目录 一.瞅一眼标准的AspectJ Aop的pointcut的表达式 二.SpringAop的十一种AOP表达式 三.演示使用 1.execution: 2.within: 3.this: 4.ta ...
- 使用Java反射(Reflect)、自定义注解(Customer Annotation)生成简单SQL语句
使用Java反射(Reflect).自定义注解(Customer Annotation)生成简单SQL语句 这次给大家介绍一下在Java开发过程中 使用自定义注解开发: 主要知识点: ...
- Java编译时注解处理器(Annotation Processor)详解
上篇文章我们使用注解+反射实现了一个仿ButterKnife功能的示例.考虑到反射是在运行时完成的,多少会影响程序性能.因此,ButterKnife本身并非基于注解+反射来实现的,而是用Annotat ...
- [ShapeInferenceError] Mismatch between number of source and target dimensions. Source=1 Target=0
Pytorch转ONNX模型正常,但使用onnxruntime加载onnx模型,会输出错误: onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ON ...
- Target “pango_windowing“ links to target “Eigen3::Eigen“ but the target was not found. Perhaps a
一.问题描述: joes@joes:~/Downloads/pangolin-master/build$ cmake .. CMake Warning at CMakeLists.txt:75 (me ...
- Spring AOP切入点@Pointcut -- execution表达式
Spring AOP 切入点@Pointcut – execution表达式 表达式示例 execution(* com.sample.service.impl..*.*(..)) 详述: execu ...
最新文章
- Centos环境下实现DNS的智能解析
- java函数实现进制转换与java实现八进制到十进制的转换(百练OJ:2735:八进制到十进制)
- Python打包之pyinstaller
- SAP License:金融工具创新与会计创新
- Tomcat环境开发技巧
- append和extend区别
- oracle有几种类型表空间,oracle 数据创建时如何指定表空间类型
- python自回归_自回归模型(AR )
- Ember -Routes
- IM即时通讯开发之iOS版微信小视频功能
- java实现业务编排_手写实现一套流程编排规则引擎
- 华为HCNA实验学习
- html怎么做向下的图标,用CSS和Bootstrap图标制作上下跳动的指示箭头动画效果
- ZJU PTA ds 6-1 Percolate Up and Down
- 其他品牌的触控笔能用在ipad上?性价比高的触控笔合集
- 【异常】java: Internal error in the mapping processor: java.lang.NullPointerException
- linux网卡驱动更新方法
- html中video获取src,HTML Video src用法及代码示例
- Oracle Distilled网站下的TimesTen相关帖子
- 加入雷锋网,与智能未来同行 1