SpringCloudConfig use

config server

1. maven add

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

2. Start the class to add annotations

@EnableConfigServer

 3.yml profile

Eureka: 
  Client: 
    Service-url: 
      defaultzone: http://10.10.10.103:8761/eureka # registry 
the Spring: 
  the Application: 
    name: CONFIG 
  Cloud: 
    config: 
      Server: 
        git: 
          # git config profile address 
          uri: https: / /github.com/qukaige/config-repo.git 
          # profile drop-down to a local folder 
          basedir: C: / SpringCloud / config / basedir 
          # username and password 
          username: 123 
          password: 1qaz 
  RabbitMQ: # MQ address 
    host: 10.10 .10.103 
    Port: 5672 
    username: the Guest 
    password: the Guest

4. git profile

 

5. Start config visit http: // localhost: 8083 / order-dev.yml to access to the configuration file in git

config client

1. Add maven

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

2. Add Configuration

spring:
  cloud:
    config:
      discovery:
        enabled: true
        service-id: CONFIG
      profile: dev

Guess you like

Origin www.cnblogs.com/412013cl/p/12022954.html
use
use