說在前面spring
本次開始spring-boot-autoconfigure源碼解析之AopAutoConfigurationspring-boot
源碼解析代理
@Configuration @ConditionalOnClass({ EnableAspectJAutoProxy.class, Aspect.class, Advice.class }) //解析spring.aop.auto=true屬性,加載aspect配置 @ConditionalOnProperty(prefix = "spring.aop", name = "auto", havingValue = "true", matchIfMissing = true) public class AopAutoConfiguration { @Configuration @EnableAspectJAutoProxy(proxyTargetClass = false) // spring.aop.proxy-target-class = false 採用jdk動態代理 @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false", matchIfMissing = true) public static class JdkDynamicAutoProxyConfiguration { } @Configuration @EnableAspectJAutoProxy(proxyTargetClass = true) // spring.aop.proxy-target-class = true 採用cglib動態代理 @ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true", matchIfMissing = false) public static class CglibAutoProxyConfiguration { } }
說在最後get
本次僅表明我的觀點,僅供參考。源碼