Spring Cloud Config
配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储、Git以及Subversion。
也就是说,我们可以使用Spring Cloud Config来获取远程服务器上的配置信息。
可以分为两个部分:
服务端: 配置服务端,服务管理配置信息
客户端:客户端调用server端暴露接口获取配置信息
构建服务端
pom文件中增加以下依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
在程序application中添加@EnableConfigServer注解,表明这是一个Config Server端
@SpringBootApplication
@EnableConfigServer
public class SpringcloudConfigApplication {
public static void main(String[] args) {
SpringApplication.run(SpringcloudConfigApplication.class, args);
}
}
在application.properties中