spring cloud config SpringCloud-Config
阿新 • • 發佈:2018-11-06
Spring boot: V2.0.6
1. Config Server
1) pom
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency>
2) yml
application.yml
server: port: 8888 spring: cloud: config: server: git: uri: https://gitee.com/xiaobin80/spring-cloud-config-repo
3) ON
Add Annotations:
@EnableConfigServer
test:
訪問git repo中的yml檔案。
格式:主機+git檔名/default
例如:
http://localhost:8888/springcloud-eureka-service/default
2. Config Client
1) pom
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency>
2) yml
bootstrap.yml
spring: application: name: springcloud-eureka-service cloud: config: uri: http://localhost:8888
3) business suit
For more information, please refer to "demo-jpa-spring-boot2-mysql"
test:
http://localhost:8790/user/list
Reference:
1. 《Spring Cloud實戰(一)-Spring Cloud Config Server》
2. 《SpringCloud-Config》