在《配置中心》这一篇博文里学习了如何git获取配置文件。大概的流程可以用下图来概括。
《配置中心》这篇博文说的是Config Server,本篇将和大家看看如何编写一个Config Client从Config Server获取配置。
1、 先在仓库中创建如下配置文件(具体参考下面地址)
https://gitee.com/hjj520/spring-cloud-2.x/tree/master/config-repos/sc-config-client
2、 创建maven项目sc-config-client,对应的pom.xml如下
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
spring-cloud
sc-config-client
0.0.1-SNAPSHOT
jar
sc-config-client
http://maven.apache.org
org.springframework.boot
spring-boot-starter-parent
2.0.4.RELEASE
org.springframework.cloud
spring-cloud-dependencies
Finchley.RELEASE