spring aop expression简单说明

来源:互联网 发布:Python与ipython 编辑:程序博客网 时间:2024/05/22 14:38
示例代码: 
<aop:config>       <aop:pointcut id="userDAO"           expression="execution(public * cn.dao.IUserDAO.*(..))" />       <aop:advisor advice-ref="tx" pointcut-ref="userDAO"/></aop:config>


在上面的代码中

execution   是方法运行

public         是指定public的方法,也可以不写直接:execution(* cn.dao.IUserDAO.*(..)

*                  是任意返回值,可以有返回值,也可以是void没有返回值的方法

cn.dao.IUserDAO.*                  是指定目录下的指定类任意方法

cn.dao.IUserDAO.insert*       是指定目录下的指定类insert开头的任意方法

cn.dao.IUserDAO.*.*              是指定目录下的任意类下的任意方法

cn.dao..*.*                                是指定目录下的任意目录下任意类下的任意方法

(..)                                              是任何参数,可以是没有参数

 

 

在execution中是可以有多个的方法,例如:

execution(* com.action.userinfoAction..*(..))&&execution(* com.action.memberAction..*(..))&&!execution(* get*(..))&&!execution(* set*(..))

原创粉丝点击