execution() 用于描述方法 【掌握】
语法:execution(修饰符 返回值 包.类.方法名(参数) throws异常)
修饰符,一般省略
public 公共方法
* 任意
返回值,不能省略
void 返回没有值
String 返回值字符串
* 任意
包,[省略]
com.qf.crm 固定包
com.qf.crm.*.service crm包下面子包任意 (例如:com.qf.crm.staff.service)
com.qf.crm.. crm包下面的所有子包(含自己)
com.qf.crm.*.service.. crm包下面任意子包,固定目录service,service目录任意包
类,[省略]
UserServiceImpl 指定类
*Impl 以Impl结尾
User* 以User开头
* 任意
方法名,不能省略
addUser 固定方法
add* 以add开头
*Do 以Do结尾
* 任意
(参数)
() 无参
(int) 一个整型
(int ,int) 两个
(..) 参数任意
throws ,可省略,一般不写。
综合1
execution(* com.qf.crm.*.service..*.*(..))
综合2
<aop:pointcut expression="execution(* com.qf.*WithCommit.*(..)) ||
execution(* com.qf.*Service.*(..))" id="myPointCut"/>
2.within:匹配包或子包中的方法(了解)
within(com.qf.aop..*)
3.this:匹配实现接口的代理对象中的方法(了解)
this(com.qf.aop.user.UserDAO)
4.target:匹配实现接口的目标对象中的方法(了解)
target(com.qf.aop.user.UserDAO)
5.args:匹配参数格式符合标准的方法(了解)
args(int,int)
6.bean(id) 对指定的bean所有的方法(了解)
bean('userServiceId')