Aspect-Oriented Programming
Spring Boot为面向切面的编程(AOP)提供自动配置。你可以在{url-spring-framework-docs}/core/aop-api.html[Spring Framework参考文档]中了解有关Spring中AOP的更多信息。
Spring Boot provides auto-configuration for aspect-oriented programming (AOP). You can learn more about AOP with Spring in the {url-spring-framework-docs}/core/aop-api.html[Spring Framework reference documentation].
默认情况下,Spring Boot的自动配置将Spring AOP配置为使用CGLib代理。若要改为使用JDK代理,请将`configprop:spring.aop.proxy-target-class`设置为`false`。
By default, Spring Boot’s auto-configuration configures Spring AOP to use CGLib proxies.
To use JDK proxies instead, set configprop:spring.aop.proxy-target-class
to false
.
如果类路径上存在AspectJ,Spring Boot的自动配置将自动启用AspectJ自动代理,这样就不需要`@EnableAspectJAutoProxy`。
If AspectJ is on the classpath, Spring Boot’s auto-configuration will automatically enable AspectJ auto proxy such that @EnableAspectJAutoProxy
is not required.