AOP——AOP表达式
来源:互联网 发布:python数据分析工具 编辑:程序博客网 时间:2024/06/01 19:36
方法签名匹配:
expression(<method scope> <return type> <fully qualified class name>.*(parametes))
method scope: Advice will be applied to all the methods having this
scope. For e.g., public, private, etc. Please note that Spring AOP
only supports advising public methods.return type: Advice will be applied to all the methods having this
return type.fully qualified class name: Advice will be applied to all the methods
of this type. If the class and advice are in the same package then
package name is not requiredparameters: You can also filter the method names based on the types.
Two dots(..) means any number and type of parameters.
示例:
execution(* com.aspects.pointcut.DemoClass.*(..)) 匹配DemoClass下所有的方法。
execution(public com.aspects.pointcut.DemoClass.*(int,int)) 匹配DemoClass下public、参数为两个int的方法。
类型签名匹配:
适用于类型符合的多有joinpoint
within(type name)
“type name”可以使包名称也可以是类名称
示例:
within(com.aspects.blog.package.*) : 匹配 com.aspects.blog.package包下所有类的所有方法。(注意:com.aspects.blog.package.abc下的类方法并不匹配)
within(com.aspects.blog.package..*) 匹配 com.aspects.blog.package包下所有类的所有方法,并且匹配其子包下所有类的所有方法。
within(com.aspects.blog.package.DemoClass) 匹配com.aspects.blog.package.DemoClass下所有方法
within(com.aspects.blog.package.DemoInterface+) : 匹配这个接口的所有实现类的所有方法
AOP表达式逻辑计算
Pointcut expressions can be combined using && (and), ||(or), and !(not).
within(com.aspects.blog.package.DemoInterface+)|| within(com.aspects.blog.package.DemoInterface2+)
匹配DemoInterface或者DemoInterface2的实现类中的所有方法
更多示例:
//the execution of any public method:execution(public * *(..))//the execution of any method with a name beginning with "set":execution(* set*(..))//the execution of any method defined by the AccountService interface:execution(* com.xyz.service.AccountService.*(..))//the execution of any method defined in the service package:execution(* com.xyz.service.*.*(..))//the execution of any method defined in the service package or a sub-package:execution(* com.xyz.service..*.*(..))//any join point (method execution only in Spring AOP) within the service package:within(com.xyz.service.*)//any join point (method execution only in Spring AOP) within the service package or a sub-package:within(com.xyz.service..*)//any join point (method execution only in Spring AOP) where the proxy implements the //AccountService interface:this(com.xyz.service.AccountService)
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html
- AOP——AOP表达式
- AOP技术研究——AOP技术基础
- AOP技术研究——AOP技术基础
- C#进阶系列——AOP?AOP!
- C#进阶系列——AOP?AOP!
- C#进阶系列——AOP?AOP!
- Spring AOP—1、AOP基本概念
- spring笔记——spirng aop切入点表达式
- Spring Aop(三)——Pointcut表达式介绍
- AOP——引言
- spring——AOP
- Spring——AOP
- Spring——AOP
- AOP——引言
- Spring——AOP
- AOP——日志
- Spring4——AOP
- Spring——AOP
- **[Lintcode]Distinct Subsequences
- 详解HTTP中的摘要认证机制
- ~初来乍到~
- ffmpeg-音频编码
- android studio配置lambda
- AOP——AOP表达式
- Android的类加载浅析
- 论位运算的作用
- 登录验证-最多允许三次
- C#用iTextSharp导出PDF到页面
- 使用真实流量请求进行系统测试
- JProfiler入门教程(2)--JProfiler安装
- C#入门经典第6版学习 九
- C++ 值传递、指针传递、引用传递详解