aop(面向切面编程)aspect
2017-07-27 本文已影响0人
海纳百川_4d26
1)使用注解@Aspect来定义一个切面,在切面中定义切入点(@Pointcut),通知类型(@Before、 @After 、@AfterReturning 、@AfterThrowing 、@Around )
![](https://img.haomeiwen.com/i5944925/a9737b6a4d41162a.png)
2)开发需要被拦截的类
![](https://img.haomeiwen.com/i5944925/d9c9c4e4cd3eca97.png)
![](https://img.haomeiwen.com/i5944925/11594951aec3e31f.png)
![](https://img.haomeiwen.com/i5944925/5bdf44ae5acd50e4.png)
3)将切面配置到xml中,也可以使用自动扫描bean方式
1)使用注解@Aspect来定义一个切面,在切面中定义切入点(@Pointcut),通知类型(@Before、 @After 、@AfterReturning 、@AfterThrowing 、@Around )
2)开发需要被拦截的类
3)将切面配置到xml中,也可以使用自动扫描bean方式