【问题标题】:How to access file in Spring Boot Cloud Config from another branch如何从另一个分支访问 Spring Boot Cloud Config 中的文件
【发布时间】:2022-02-01 19:05:53
【问题描述】:

当连接一个git配置的spring boot cloud config server时,如何引用不同的分支?

目前我可以通过 curling localhost:4001/myservicename/default 访问子文件夹的数据。 myservicename 是一个子目录,我的 application.properties 包括子文件夹:spring.cloud.config.server.git.searchPaths=myservicename 当前的默认标签是:spring.cloud.config.server.git.default-label=main

【问题讨论】:

  • localhost:4001/myservicename/default/branch

标签: spring spring-boot spring-cloud


【解决方案1】:

就像@spencergibb 回答的那样,您可以使用下一个链接访问分支:

localhost:4001/myservicename/default/branch

解释这个链接

<server ip/fqdn>:<port>/<service name>/<profile name>/<branch name>

更多信息:要拥有不同的配置文件版本,您需要创建这样的文件

app-name-<profile>.properties

现在要从 spring 代码访问不同的分支,您需要将下一行添加到 application.properties 文件

spring.cloud.config.label=<branch

【讨论】:

    猜你喜欢
    • 2019-05-05
    • 2019-08-20
    • 2020-08-15
    • 2021-03-29
    • 2021-11-16
    • 2017-10-20
    • 2016-06-04
    • 2016-07-29
    • 2017-10-12
    相关资源
    最近更新 更多