基本注解
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/>
本文详细介绍了AspectJ中的AOP注解及其使用方法,包括@Before、@AfterReturning等核心注解,并提供了如何在Spring配置文件中启用AspectJ的支持。
912

被折叠的 条评论
为什么被折叠?



