AOP
2018-02-04 本文已影响0人
刘磊_3a3b
一、增加依赖
![](https://img.haomeiwen.com/i8358164/b2895f8add9c8de1.png)
二、开发切面类aspect
增加注解@Aspect表明这是一个切面,增加注解@Component使其被spring管理
![](https://img.haomeiwen.com/i8358164/c26e8a53e1ec9fef.png)
三、
@Pointcut("execution(...)")表示controller包下所有的类的所有方法都会经过这个切面
@Before()表示在进入方法前执行
![](https://img.haomeiwen.com/i8358164/b8ca0f60f59a93d3.png)
一、增加依赖
二、开发切面类aspect
增加注解@Aspect表明这是一个切面,增加注解@Component使其被spring管理
三、
@Pointcut("execution(...)")表示controller包下所有的类的所有方法都会经过这个切面
@Before()表示在进入方法前执行