一个Spring的AOP练习程序。
\---springdemo
│ SpringDemoApplication.java
│
├─aop
│ MyAspect.java
│
├─controller
│ Test.java
│
└─service
Another.java
对于Spring来说,其AOP的实现十分简单。只需要在导入相关依赖之后在注解类上使用@Aspect和@Component注解,然后使用@Pointcut定义切点,在相关方法上用你需要的AOP通知类型注解即可。