Spring 2.0及以上AOP 切点配置整理

来源:互联网 发布:淘宝卖煎饼许可证 编辑:程序博客网 时间:2024/05/10 20:49

 

常见的情况:

示例1:

com.accp.service..*Service.*(..)

com.accp.service —— 包“com.accp.service”
com.accp.service.. —— 包“com.accp.service”及其子包,比如:“com.accp.service.abc”,“com.accp.service.user”等

*Service —— 定义接口(或没有实现接口的类,需要使用cglib代理)表达式;所有以Service结尾的类或接口,注意不是所有以Service结尾的包名。
*(..) —— 定义方法名,方法参数表达式;任意方法的名称,任意方法参数。

 

示例2:

com.accp.service.*.*(..)
com.accp.service —— 包“com.accp.service”
*.*(..) —— 任意接口(或没有实现接口的类,需要使用cglib代理),任意方法,任意参数
在service包下定义的任意方法的执行。

com.accp.service..*.*(..)
com.accp.service —— 包“com.accp.service”
com.accp.service.. ——包“com.accp.service”及其子包
*.*(..) —— 任意接口(或没有实现接口的类,需要使用cglib代理),任意方法,任意参数

 

原创粉丝点击