面向切面程式設計
Spring Boot 為面向切面程式設計 (AOP) 提供自動組態。您可以在 Spring Framework 參考文件中了解更多關於 Spring AOP 的資訊。
預設情況下,Spring Boot 的自動組態會將 Spring AOP 組態為使用 CGLib 代理。若要改用 JDK 代理,請將 spring.aop.proxy-target-class
設定為 false
。
如果 AspectJ 在類別路徑上,Spring Boot 的自動組態將自動啟用 AspectJ 自動代理,因此不需要 @EnableAspectJAutoProxy
。