问题标签 [spring-cloud-config]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
18909 浏览

git - Spring Cloud,配置服务器无法启动,如何为git配置uri

我对 Spring Cloud 项目很感兴趣,现在我正在测试它,但立即被阻止。

  1. 在 POM 中:我添加了这个依赖项:
  1. 对于主要应用:

所以根据文档,我只需要添加enableConfigServer,然后我尝试启动它,这是错误:

org.springframework.beans.factory.BeanCreationException:创建类 org.springframework.cloud.config.server.ConfigServerConfiguration$GitRepositoryConfiguration 中定义的名称为“environmentRepository”的 bean 时出错:调用 init 方法失败;嵌套异常是 java.lang.IllegalStateException: 您需要为 git 存储库配置一个 uri

那么,如何为 git 存储库配置 uri?文档中没有提到任何内容。

感谢您的更多澄清

0 投票
3 回答
4856 浏览

spring - 我可以拥有多个 Spring Cloud Config Server 吗?

我知道我可以使用超过 1 个存储库将我的配置分布到多个存储库(可能针对每个应用程序)但是,我可以为这些存储库运行超过 1 个配置服务器,这样我们就可以避免单点故障配置服务器'

如果我们可以运行多个配置服务器,我如何将我的客户端从访问任何一个特定的配置服务器中抽象出来?

更新(进一步阅读后):如果我使用一个负载平衡多个 IP 的 URL,而不是在 URI 中使用 IP ,它会解决我在 Config Server 上的单点故障问题吗?

spring.cloud.config.uri:http ://myconfigserver.com

0 投票
4 回答
10551 浏览

spring - Spring Cloud Config Server 跨应用程序共享属性

我目前有许多可部署的应用程序,它们以分布式方式工作以解决业务问题。我们目前正在使用许多属性配置文件来根据系统环境变量为每个环境提供更改配置。所有这些可部署的应用程序共享数据库和消息传递的通用配置。目前,这是通过从类路径中获取属性文件并让两个部署的应用程序为包含属性文件的每个连接(db、jms)共享一个公共 jar 来实现的。

如果可能,我希望开始使用 Spring Config Server 来外部化此配置。我有一个关于如何共享这个通用配置的问题。

目前它看起来像这样:-

Web1
- 数据库
- jms

Messaging1
- 数据库
- jms

在这种情况下,两个部署的应用程序共享相同的连接,并且这些连接随环境(实验室、prf、prd 等)而变化。如何使用 Spring Configuration Server 实现相同的功能,其中每个可部署应用程序都有应用程序配置?

Application.yml
Web1.yml Web1
-dev.yml
Messaging1.yml
Messaging1-dev.yml

如果某个环境的连接属性发生更改,我需要对每个可部署的应用程序配置进行更改,而不是只更改一次。

目前有没有办法实现这一目标?我只是错过了一个简单的观点吗?

0 投票
2 回答
2399 浏览

java - 使用 spring-cloud-config-client 时如何配置自定义 RestTemplate?

我正在尝试使用 spring-cloud-config-client 在启动时从 spring-cloud-config-server 应用程序读取我的配置属性。我的应用程序是一个 Spring-Boot 应用程序,我需要做的是在请求被发送到配置服务器之前添加一个特定的标头。

我已阅读文档(http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html),但找不到任何方法来使用提供的 RestTemplate 自定义 ConfigServicePropertySourceLocator。

最好的方法是什么?

非常感谢

0 投票
7 回答
30112 浏览

java - 在没有 Git 存储库的情况下使用 Spring Cloud Config

是否可以在不使用任何 Git 存储库的情况下使用 Spring Cloud Config?我正在尝试在 application.properties 中使用本地目录对其进行测试:

spring.cloud.config.server.git.uri=file://${user.dir}/src/main/resources/config-repo

但我收到以下错误:

java.lang.IllegalStateException:文件中没有 .git://path/to/src/main/resources/config-repo

那么,如果一个人根本不使用 Git,就不可能使用 Spring Cloud 吗?

更新:

感谢 Spencer 的建议,我添加了以下内容:

spring.profiles.active=native spring.cloud.config.server.native.searchLocations=${user.dir}/src/main/resources/configs

我在“configs”中有一个文件“bar.properties”,内容如下:

但是我得到的响应不是读取文件:

我使用的 URL 是http://localhost:8888/bar/default

我还缺少其他东西吗?再次提前感谢!

0 投票
4 回答
13568 浏览

java - 带有配置服务器的 Spring Cloud Eureka

同时运行 Config Server 和 Eureka Server 时推荐的配置是什么?Config Server 应该是 Eureka 的客户端吗?或者 Eureka 是否应该依赖 Config Server 属性进行配置?还是两者都可以?

0 投票
3 回答
5619 浏览

spring - 如何在 Spring Cloud Config 中使用自定义 ssh 密钥位置

我正在尝试设置一个使用自定义位置作为 ssh 私钥的Spring Cloud Config服务器。我需要为密钥指定自定义位置的原因是因为运行应用程序的用户没有主目录..所以我无法~/.ssh为我的密钥使用默认目录。我知道可以选择创建只读帐户并在配置中提供用户/密码,但 ssh 方式接缝更干净。
有没有办法可以设置这个?

0 投票
1 回答
5732 浏览

spring-boot - 使用 HashiCorp Consul 和 Spring Boot 进行分布式配置

我想知道如何使用 Spring Boot 在 HashiCorp Consul 中共享一些属性,我读到了依赖项“spring-cloud-consul-config”,但我找不到如何从那里加载包含所有属性文件的文件夹。

使用 Spring Cloud Config Server 这是可能的,例如:

但是,如何在 Spring Cloud Config Consul 中做到这一点?

0 投票
2 回答
5076 浏览

spring-cloud - 使用 config-server 加载多个属性

我已经成功测试了从 SVN 存储库加载属性,目前在我的配置服务器中,我提供了 URI 和 default-label: trunk 并且我在trunk. 以下是我的消费应用程序的内容,application.yml并且能够成功提取属性

现在我在其他应用程序之间共享的不同文件夹中有一个共享属性,所以我如何将它与我的应用程序特定一起加载到我的应用程序中

0 投票
1 回答
3353 浏览

spring-boot - 使用 Cloud Config Server 时的 Spring Boot 外部配置顺序?

我开始使用 Spring Cloud Config,并希望为客户端提供一种方法来覆盖来自 cofnig 服务器的属性。但是,在阅读https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html后,云配置何时适用并不明显。

我还阅读了http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html并谈到了覆盖。但它们似乎与我想要的相反(这些覆盖是为了覆盖客户端提供的属性)。

那么,Cloud Config 在排序中的位置是什么?我仍然可以application.properties在类路径上提供一个本地文件来覆盖某些 Cloud Config 属性吗?