基本注解
Advice的类型
@Before
@AfterReturning
@Around
@AfterThrowing
@After
表达式
execution(expression)
expression(<访问修饰符>?<返回类型><方法名(<参数>)<异常>)
execution(public * *(..)) 匹配所有的public方法
execution(* com.ywkj.*(..)) 匹配指定包下的所有方法
execution(* com.ywkj..*(..)) 匹配指定包下的所有的方法,包括子包下的
execution(* com.ywkj.InterfaceName+.*) 匹配实现特定接口所有类方法
execution(* save*(..)) 匹配所有以save开头的方法
使用
@Aspect
在applicationContext.xml中开启AspectJ的自动代理
<aop:aspectj-autoproxy/>