Spring Boot 中的 AOP 是哪种代理模式?

总结:

  • Spring 中的 AOP,有接口默认就用 JDK 动态代理,没有接口就用 CGLIB 动态代理。

    但可以设置 @EnableAspectJAutoProxy(proxyTargetClass = true) 强制使用 CGLIB。

  • Spring Boot 中的 AOP,2.0 之前与 Spring 一样;2.0 之后默认使用 CGLIB 动态代理,如需使用 JDK 动态代理,需在 application.properties 中配置 spring.aop.proxy-target-class=false

曾梦想仗剑走天涯,后来没钱就没去