使用 Spring 云配置和 GIT 读取配置时出现问题

Problems reading configuation using Spring cloud config with GIT

我正在关注 spring.io 中的 Spring 云配置示例。尝试使用 git 从属性文件中读取 属性。我尝试了 Whosebug 中针对类似问题给出的建议,但没有用。有什么见解可以帮助解决这个问题吗?

顺便说一句,我正在使用 Windows 10,JDK 8,Spring Boot 2.0.4

这是我在服务器端的配置。我尝试了 git 和 native 但没有运气:

spring:
  profiles:
    active:
    # - native
    - development

---
spring:
  profiles: native
  cloud:
    config:
      server:
        native:
          search-locations:
          - C:/config-repo
--- 

spring:        
  profiles: development

# using git  

  cloud:
    config:
      server:
        git:
          uri: file:///C:/config-repo

---

server:
  port: 8888   

config.properties file exists in C:\config-repo
 contents of config.properties:

        message = "Hello Spring Boot config"

Config 客户端配置:

    public class SpringCloudconfigClientApplication {

        public static void main(String[] args) {
            SpringApplication.run(SpringCloudconfigClientApplication.class, args);
        }
    }

    @RefreshScope
    @RestController
    class MessageRestController {

        @Value("${message:Hello default}")
        private String message;

        @RequestMapping("/message")
        String getMessage() {
            return this.message;
        }
    }

我认为客户端应用程序名称应该与属性文件名称匹配。我不确定这是否要求文件名与配置服务器中的 properties/yml 文件匹配。

客户端bootstrap.yml:

spring:
  application:
    name: config

  cloud:
    config:
      uri:
      - http://localhost:8888

application.yml:

management:
  endpoints: 
    web: 
      exposure: 
        include:
        - '*'

配置服务器application.yml:

spring:
  profiles:
    active:
    # - native
    # - development
    - remote_repo

---
spring:
  profiles: native
  cloud:
    config:
      server:
        native:
          search-locations:
          - C:/config-repo
--- 

spring:        
  profiles: development

# using git/local file system 

  cloud:
    config:
      server:
        git:
          uri: file:///C:/config-repo

---

spring:        
  profiles: remote_repo

# using git/local file system 

  cloud:
    config:
      server:
        git:
          uri: https://github.com/<<YOUR_USER_NAME>>/cloud-config-repo
          skip-ssl-validation: true
          username: <<YOUR_USER_NAME>>
          password: <<YOUR_REPO_PASSWORD>>

---

server:
  port: 8888