基于 Annotation 的“零配置”方式
1、启用 Spring 对 @AspectJ 切面配置的支持
<aop:aspectj-autoproxy/>
<bean class="org.springframeword.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator" />
2、定义切面 Bean
当启动了@AspectJ 支持后,只要在 Spring 容器中配置一个带@Aspect 注释的 Bean, Spring 将会自动识别该 Bean 并作为切面处理
3、定义 Before 增强处理
@Before("execution(* com.wicresoft.app.service.impl.*.*(..))")
4、定义 AfterReturning 增强处理
@AfterReturning(returning="rvt", pointcut="execution(* com.wicresoft.app.service.impl.*.*(..))")
5、定义 AfterThrowing 增强处理
@AfterThrowing(throwing="ex", pointcut="execution(* com.wicresoft.app.service.impl.*.*(..))")
6、定义 After 增强处理
@After("execution(* com.wicresoft.app.service.impl.*.*(..))")
7、Around 增强处理
@Around("execution(* com.wicresoft.app.service.impl.*.*(..))")
8、访问目标方法的参数
9、定义切入点