spring基于AspectJ的AOP开发
AOP开发中的相关术语
1.基于xml(此次略)
2.基于注解
(1)application.xml中加如下配置:
<!-- 使AspjectJ 注解起作用:自动为匹配的类生成代理对象-->
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
(2)切面要加入@Component,使它是一个IOC的一个bean
还需要加入@Aspect 注解
(3)在切面类中声明各种通知@Before,@After,@AfterRunning,@AfterThrowing,@Around等
(4)@Pointcut声明切入点,@Order(xx)表示优先级