Spring 云配置目录结构

Spring cloud config directory structure

我有一个可用的 Spring 云配置服务器,它提供来自 git 存储库的配置。所有配置都存储在存储库的根目录中。他们被命名为 {name}-{profile}.yml.

我已经将目录结构更改为{name}/{profile}.yml

当我 curl http://configserver:8888/appname/myprofile 配置服务器时,我收到 json 响应,但 propertySources 为空。

我的spring云服务器配置

spring:
  cloud:
    config:
      server:
        git:
          uri: http://git@git.host/scm/cas/application-config.git

您需要将cloud.config.server.git.searchPaths添加到配置服务器application.yml。

   cloud:
     config:
       server:
         git:
           searchPaths: <directory>