简体   繁体   English

Spring cloud配置组织文件夹中的文件

[英]Spring cloud config organising files in folders

I'm trying to organise a set of config files in folders within my Git repo. 我正在尝试在我的Git仓库中的文件夹中组织一组配置文件。 I read in the Spring Cloud Docs this can be done this way: 我在Spring Cloud Docs中读到了这可以这样做:

The HTTP service has resources in the form: HTTP服务具有以下形式的资源:

 /{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties 

So I created my config structure following the first pattern: 所以我按照第一个模式创建了我的配置结构:

app1/uat/application.yml

But the Config service doesn't find it. 但Config服务找不到它。 It doesn't really say much about what the files inside the profile folder should look like, and everywhere I see examples of the 2nd and 4th patterns. 它并没有真正说明配置文件文件夹中的文件应该是什么样子,并且在任何地方我都看到了第2和第4个模式的示例。

Does the first pattern actually work? 第一种模式真的有效吗? Can anybody give an example? 谁能举个例子?

Solved, just needed to add: 解决了,只需添加:

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/your-repo
          searchPaths: '{application}/{profile}'

That will do the trick 那就行了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM