Spring(5) -(14) pointcut 语法

AOP的规范本应该由SUM公司提出,但是被AOP联盟捷足先登.AOP联盟指定AOP规范,首先就要解决一个问题,怎么表示切入点,也就是在哪些方法上增强(where)
AspectJ 是一个面向切面的框架:
AspectJ切入点语法如下:
(表示在哪些包下的哪些类的哪些方法做切入增强)
execution(modifiners-pattern?ret-type-pattern declaring-type-pattern? name-param(param-patterm)throws-pattern?) ?
表示:该参数可以出现一次或零次
翻译成中文: execution( <修饰符>?<返回类型> <声明类型>?<方法名>(<参数>)<异常>?)
举例:public static Class java.lang.Class.forName(String className) throws ClassNotFoundException
 
通配符

*

匹配任何部分,只能表示一个单词

..

可用于全限定名中和方法参数中,分别表示子包和0到N个参数

spring-core 文档中的例子

Some examples of common pointcut expressions are given below.
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..*.*(..))//常用 


作者:小白201808
链接:https://www.jianshu.com/p/f82b6933d78f
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

转载于:https://www.cnblogs.com/shew/p/11258864.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值