Spring Cloud Config Server 源码分析
LD is tigger forever,CG are not brothers forever, throw the pot and shine.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code,Keep progress,make a better result.
目录
概述
架构特性
设计思路
实现思路分析
从@EnableConfigServer开始
为了让一个spring boot应用成为配置中心,我们需要使用@EnableConfigServer注解
@Configuration
public class ConfigServerConfiguration {
class Marker {}
@Bean
public Marker enableConfigServerMarker() {
return new Marker();
}
}
EnvironmentRepositoryConfiguration
CompositeConfiguration
ResourceRepositoryConfiguration
ConfigServerEncryptionConfiguration
ConfigServerMvcConfiguration
TransportConfiguration
EnvironmentRepositoryConfiguration
EnvironmentRepositoryConfiguration是配置中心的关键Configuration类。这个配置类中包含很多实现了EnvironmentRepository接口的类,每个实现类都对应一种类型(git/svn/navtie/vault)的配置。 EnvironmentRepositoryConfiguration通过profile注解(对当前应用的环境)决定使用装配哪个EnvironmentRepository Bean。默认是MultipleJGitEnvironmentRepository
相关工具如下:
实验效果:(解决思路)
分析:
小结:
主要讲述了一些Spring Cloud Config使用详解,里面有许多不足,请大家指正~