【问题标题】:Spring config server read proterties from local machine if fetch data from git repositories failed如果从 git 存储库获取数据失败,则 Spring 配置服务器从本地机器读取属性
【发布时间】:2019-03-13 20:56:57
【问题描述】:

我是spring config server的新手。我想从我的应用程序中实现 spring config server,我的配置服务器 fetch properties details from git repositories 但如果是我的 git服务器无法响应,如何从本地计算机读取属性?

注意:我只想在我的 git 服务器无法响应的情况下从本地机器读取属性。

【问题讨论】:

    标签: git spring-boot spring-cloud-config spring-properties spring-boot-configuration


    【解决方案1】:

    您可以通过存储库进行以下配置。

    spring:
      cloud:
        config:
          server:
            git:
              uri: https://github.com/your-repository/config-repo
              repos:
                local:
                  pattern: local*
                  uri: file:/home/your-directory/config-repo
    
    1. local 存储库将匹配所有配置文件中以 local 开头的所有应用程序名称。
    2. 如果与所有配置文件中以 local 开头的应用程序名称不匹配,则默认 URI spring.cloud.config.server.git.uri 值将被替换。

    这是关于它的文档config-server-multiple-repositories

    【讨论】:

      猜你喜欢
      • 2021-03-29
      • 1970-01-01
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 2021-01-04
      • 2020-08-10
      • 1970-01-01
      • 2017-07-22
      相关资源
      最近更新 更多