使用Spring Cloud Config时Config Server的角色似乎很愚蠢,托管它似乎是不必要的开销。有没有办法让客户端直接从git repo中读取配置?
答案 0 :(得分: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 repo(在所需分支上检出)并解决了原始存储库中的更新,则可能会起作用。
答案 1 :(得分:0)
可通过嵌入配置服务器方法来实现 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).