spring-cloud @RefereshScope 热更新源码分析

1.spring 解析@RefreshScope @ConfigurationProperties @configuration 注解的类
1.1 ClassPathBeanDefinitionScanner.doScan(String… basePackages)

spring-cloud @RefereshScope 热更新源码分析@RefreshScope 默认 name=“refresh” proxy-mode=target-class

1.2AnnotationConfigUtils.applyScopeProxyMode()

spring-cloud @RefereshScope 热更新源码分析
1.3 ScopedProxyUtils.createScopedProxy()
spring-cloud @RefereshScope 热更新源码分析该方法很重要,生成了一个代理类proxyDefinition和OriginalBeanName关联,同时把 targetBeanName【在 原name上加上ScopeTarget.】关联被代理的对象。

	// The target bean should be ignored in favor of the scoped proxy.
	targetDefinition.setAutowireCandidate(false);
	targetDefinition.setPrimary(false);

此处设置被代理的类不能自动注入,让代理对象依赖注入。