springcloud的config

CONFIG服务端

加入依赖:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

yml文件配置:

server:
  port: 3344
spring:
  application:
    name: microservicecloud-config
  cloud:
    config:
      server:
        git:
          uri: [email protected]:********    #github上面的git仓库的名字

CONFIG客户端:

引入依赖

  <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

yml文件(bootstrap.yml优先级最高)

spring:
  cloud:
    config:
      name: microservicecloud-config-client   #需要从github上读取资源名称,
      profile: dev      #访问配置项为dev
      label: master
      uri: http://localhost:3344    #去3344号上通过config获取github上的服务地址

猜你喜欢

转载自www.cnblogs.com/javage/p/9493732.html