面向切面编程
Spring Boot 为面向切面编程(AOP)提供了自动配置。你可以在 Spring Framework 参考文档 中了解更多关于 Spring AOP 的内容。
默认情况下,Spring Boot 的自动配置会将 Spring AOP 配置为使用 CGLib 代理。要改为使用 JDK 代理,请将 spring.aop.proxy-target-class
设置为 false
。
如果 AspectJ 在类路径上,Spring Boot 的自动配置将自动启用 AspectJ 自动代理,因此不需要使用 @EnableAspectJAutoProxy。