1.spring--创建项目,选择 CouldDiscovery --->Eureka Discovery  + Cloud Config ---->Config Server 

2.启动类加入注解:@EnableDiscoveryClient

   配置application.yml 

3.在github上创建一个项目,本地提交一个application.yml到github的仓库中

4.创建一个文件,起名为order,将application.yml中的内容复制上去

5.在本地的测试项目中,application.yml配置github的访问仓库地址和账号密码

spring:
  application:
    name: config
  cloud:
    config:
      server:
        git:
          uri: https://github.com/jinqiwen/config-repo
          username: jinqiwen
          password: ***********
eureka:
  client:
    service-url:
       defaultZone: http://localhost:8761/eureka/

启动项目,浏览器访问localhost:8080/order-a.yml,如下图,也可是order-b.yml/properties/json等

springCloud-ConfigServer





相关文章:

  • 2022-12-23
  • 2021-10-07
  • 2021-09-22
  • 2022-01-14
  • 2021-11-18
  • 2021-11-29
  • 2022-12-23
  • 2022-01-05
猜你喜欢
  • 2021-11-25
  • 2021-06-21
  • 2021-12-24
  • 2021-05-13
  • 2021-12-17
  • 2021-09-06
  • 2022-12-23
相关资源
相似解决方案