【问题标题】:Spring Cloud Config without the server没有服务器的 Spring Cloud Config
【发布时间】:2019-02-12 09:22:15
【问题描述】:

使用 Spring Cloud Config 时 Config Server 的角色似乎很愚蠢,托管它似乎是不必要的开销。有没有办法让客户端直接从 git repo 读取配置?

【问题讨论】:

    标签: spring system spring-cloud spring-cloud-config spring-config


    【解决方案1】:

    您可以让 Spring Boot 查看配置文件的特定位置:https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files

    如果您将此位置设置为克隆的 git 存储库(在您需要的分支上签出)并解决来自原始存储库的更新,这可能会起作用。

    【讨论】:

      【解决方案2】:

      可以通过嵌入配置服务器方法实现 Do refer to Embedding The Config Server section

      If you want to read the configuration for an application directly from the backend repository (instead of from the config server), you basically want an embedded config server with no endpoints. You can switch off the endpoints entirely by not using the @EnableConfigServer annotation (set spring.cloud.config.server.bootstrap=true).

      【讨论】:

        猜你喜欢
        • 2018-11-10
        • 1970-01-01
        • 2019-10-15
        • 2018-10-31
        • 1970-01-01
        • 1970-01-01
        • 2019-02-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多