Spring AOP配置选项的一些参数
总结一下spring3 的aop常用配置
aop:config
?
Attribute : proxy-target-class
如果没有实现接口,可以使用cgilib来实现AOP,定义为true
?
Data Type : boolean
Default Value : false
Enumerated Values :?
- true
- false
?
?
aop:pointcut -?expression ?
execution(方法修饰
?返回值类型
类路径
方法名(参数)
异常类型)
其中 方法修饰、类路径、异常类型是可选项。
1、匹配所有方法
execution(* * *(..))
2、任意公用方法
execution(public * *(..))
3、定义在service包里的任意方法的执行:
execution(* com.xyz.service.*.*(..))
4、定义在service包或者子包里的任意方法的执行:
execution(* com.xyz.service..*.*(..))
5、多个修饰 ?连接符 or 和and
execution( (* com.xyz.a.service..*.*(..)) and com.xyz.b.service..*.*(..))