服务端
引入依赖
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-config-server --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> <version>2.0.3.RELEASE</version> </dependency>
YML
server:
port: 9100
spring:
application:
name: config-server-demo
cloud:
config:
server:
git:
uri: https://gitee.com/yidiankt/config-server-demo.git
# 匹配仓库的路径 下的所有文件
search-paths: /**
username:
password:
# 分支
label: master
客户端
依赖
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-config-server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-config -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>