我正在尝试在我的 Git 存储库中的文件夹中组织一组配置文件。 我读了Spring Cloud Docs这可以通过这种方式完成:
The HTTP service has resources in the form:
/{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties
所以我按照第一种模式创建了我的配置结构:
app1/uat/application.yml
但是配置服务没有找到它。它并没有真正说明配置文件文件夹中的文件应该是什么样子,而且我到处都能看到第二种和第四种模式的例子。
第一个模式真的有效吗?谁能举个例子?
最佳答案
已解决,只需要添加:
spring:
cloud:
config:
server:
git:
uri: https://github.com/your-repo
searchPaths: '{application}/{profile}'
这样就可以了
关于java - Spring Cloud 配置在文件夹中组织文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37251455/