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