问题标签 [spring-cloud-config-server]

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 投票
0 回答
15 浏览

spring-boot - 在springboot中实现sping cloud config server和spring cloud client作为子模块

我有一个 springboot 多模块项目。我又添加了一个模块并将其配置为 spring-cloud-config-server。当我运行包装器模块时,我可以访问 localhost:8080/actuator/default 。我正在制作我的包装器作为 config-client.i 的模块提供了所有必需的配置。但是它不从云服务器获取数据。

1->我保持 config-server module-server.port 与 wrapper-module 相同

我在控制台中看不到“cccConfigServicePropertySourceLocator:从服务器获取配置”

谁能告诉我我可能会错过什么?

0 投票
0 回答
183 浏览

spring-profiles - 无法在 bootstrap.yml 或 application.yml 上定义配置文件

我正在构建一个带有 jdbc 后端的 Spring Cloud Server,这是我的 bootstrap.yml:

当运行我的应用程序时,它会在控制台上显示

没有活动配置文件集,回退到默认配置文件:默认

我已经尝试将此属性放在 application.yml 上,但结果仍然相同。

虽然当我只是将 -Dspring.profiles.active=jdbc 添加到 intellij 上的 VM 选项时它可以工作。但我想在 yml 上定义这个属性

这是我的 pom.xml:

0 投票
1 回答
31 浏览

properties - Spring Profiles 与 ConfigServer 结合

我有一个非常基本的 Spring Boot 配置服务器(刚刚添加了依赖项并使用 @EnableConfigServer 注释了主类)。

一般来说,我想为我的每个应用程序支持具有不同属性源的多个环境,这是 ConfigServer 本身的示例:

配置文件:默认(类路径上的 application.yml):

在此处输入图像描述

配置文件:docker(类路径上的 application-docker.yml):

在此处输入图像描述

配置文件:默认(ConfigServer 存储库中的 application.yml):

在此处输入图像描述

因此,在我的情况下,所有三个屏幕截图中的所有属性都应该处于活动状态,我希望顺序/优先级如下:

  1. 来自类路径的 application.yml
  2. application-来自类路径的ANY_PROFILE .yml
  3. 来自配置仓库的 application.yml
  4. 来自配置仓库的APP-NAME .yml(在这种情况下不存在)

到目前为止,这完美无缺,除了我遇到的问题是,当我使用命令启动应用程序时(当然是在容器内),类路径上的 application-docker.yml 被忽略:

正如你在这里看到的: 在此处输入图像描述

我的问题是,即使我将配置文件作为命令行参数提供,它也不会被拾取。这是为什么?

更新,这里是 Dockerfile 和 entrpoint.sh:

在此处输入图像描述

在此处输入图像描述

0 投票
1 回答
319 浏览

spring-boot - 无法使用 Cloud Config Server 从 GIT 存储库中读取 application.properties

我正在尝试使用 Spring Boot Cloud Config 服务器从我的 GIT 存储库中获取内容 application.properties,其中我保存了尤里卡服务器的 URL。我正在使用带有云依赖版本的 Spring Boot 版本 2.3.4 - Hoxton.SR5。

我的配置服务器中的 application.properties:

配置服务器启动:

2021-04-26 20:48:44.711 INFO 14260 --- [main] m.EmployeeCloudConfigServerSBApplication:未设置活动配置文件,回退到默认配置文件:默认

2021-04-26 20:48:45.486 INFO 14260 --- [主] oscloud.context.scope.GenericScope:BeanFactory id=53849fa2-bc07-3ec6-b44c-0fe3da5e9e6a

2021-04-26 20:48:45.933 INFO 14260 --- [main] osbwembedded.tomcat.TomcatWebServer:Tomcat 使用端口初始化:8888 (http)

2021-04-26 20:48:45.943 INFO 14260 --- [main] o.apache.catalina.core.StandardService:启动服务 [Tomcat]

2021-04-26 20:48:45.943 INFO 14260 --- [main] org.apache.catalina.core.StandardEngine:启动 Servlet 引擎:[Apache Tomcat/9.0.38]

2021-04-26 20:48:46.072 INFO 14260 --- [main] oaccC[Tomcat].[localhost].[/]:初始化 Spring 嵌入式 WebApplicationContext

2021-04-26 20:48:46.072 INFO 14260 --- [main] wscServletWebServerApplicationContext:根 WebApplicationContext:初始化在 1345 毫秒内完成

2021-04-26 20:48:46.427 INFO 14260 --- [main] ossconcurrent.ThreadPoolTask​​Executor:初始化 ExecutorService 'applicationTaskExecutor'

2021-04-26 20:48:49.936 INFO 14260 --- [main] osbaeweb.EndpointLinksResolver:在基本路径“/actuator”下暴露 2 个端点

2021-04-26 20:48:49.986 INFO 14260 --- [main] osbwembedded.tomcat.TomcatWebServer:Tomcat 在端口上启动:8888 (http),上下文路径为“”

2021-04-26 20:48:50.199 INFO 14260 --- [main] m.EmployeeCloudConfigServerSBApplication:在 6.533 秒内启动 EmployeeCloudConfigServerSBApplication(JVM 运行 6.87)

2021-04-26 20:48:59.226 INFO 14260 --- [nio-8888-exec-1] oaccC[Tomcat].[localhost].[/]:初始化 Spring DispatcherServlet 'dispatcherServlet'

2021-04-26 20:48:59.226 INFO 14260 --- [nio-8888-exec-1] osweb.servlet.DispatcherServlet:初始化 Servlet 'dispatcherServlet'

2021-04-26 20:48:59.234 INFO 14260 --- [nio-8888-exec-1] osweb.servlet.DispatcherServlet:在 8 毫秒内完成初始化

当我点击 URL - http://localhost:8888/config-server-git/default

或者

http://localhost:8888/sb-employee-cloud-config-server-git/default,我得到“白标签错误页面”屏幕。

我的生产者服务中的 application.properties:

你能否建议如何克服这个问题。我正在尝试测试应用程序,因为我在我的官方应用程序中遇到了同样的问题。

谢谢,文卡特什

0 投票
2 回答
3376 浏览

spring - 引起:org.eclipse.jgit.api.errors.RefNotFoundException: Ref master 无法解析

我正在开发Spring Boot 2.4.2.RELEASEconfig-server为我的微服务项目进行开发。以下是我到目前为止开发的代码。

配置服务器应用程序.java

应用程序属性

pom.xml

错误

0 投票
2 回答
1017 浏览

spring - Spring Boot 2.4.x - @RefreshScope 不工作

我已经浏览了许多链接,例如@RefreshScope 和 /refresh not workingSpring Boot 2: Refresh properties on the fly not working,但仍然对我不起作用。

我开发了 spring-cloud-config-server

当我打

POST ==> http://localhost:8002/actuator/refresh

我得到回应

[“config.client.version”]

看起来它以某种方式没有加载更改的属性

pom.xml:

属性访问Bean.java:

属性访问值.java:

用户控制器.java:

引导程序属性:

应用程序.yml:

0 投票
0 回答
129 浏览

java - Spring Cloud Config vs Spring Cloud Consul Config KV

目前,在项目中,我们使用的是配置服务器。但是每当 git 中发生属性更改时,我们将不得不手动点击 /refresh 之类的端点,或者我们应该使用 spring cloud bus。我们可以在这里而不是配置服务器将我们的属性放在 Consul kV 中(将属性从 git 推送到 consul)吗?保留 consul kV 或配置服务器(弹簧云总线)的更好方法是什么?为什么?

0 投票
0 回答
87 浏览

spring-boot - Spring 配置服务器无法从 codecommit 获取属性

我在使用 Kubernetes 服务帐户授予对 spring 配置服务器的 codecommit 存储库的访问权限时遇到了问题。

当 AWSCodeCommitReadOnly 被授予 EKS cluster.worker-node 角色时,配置服务器能够成功获取属性,但是使用服务帐户复制它会导致配置服务器抛出以下错误:

已使用 CodeCommit 策略创建了一个单独的 IAM 角色,并将其附加到带有注释的服务账户:

iam 角色具有 eks 集群的受信任实体和以下条件:

我们还创建了一个集群角色,它应该可以访问所有动词/资源:

和相关的绑定:

按照此文档https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.html,我们似乎已经勾选了所有框,因此我们不确定可能缺少什么。

部署添加了服务帐户,当我们执行到 pod 中时,它会穿上 IAM 角色 ARN:

一个单独的服务帐户可以覆盖我们在这里尝试授予的权限吗?我们更新了配置服务器 pom 以将 1.11.623 用于 aws-java-sdk-core,并添加了 aws-java-sdk-sts 的依赖项

0 投票
0 回答
47 浏览

spring-boot - Config Server 停止将更改传播到升级到 Spring Boot 2.4.5 的微服务

我们曾经在 spring boot 2.2 上运行我们的微服务,但我们决定升级到最新的 SB 2.4.5,在一项服务中,我们启用了新配置文件的使用。

我们将此新功能主要用于本地开发覆盖。

当涉及到我们的云部署时,使用配置服务器推送配置。不幸的是,配置服务器不再设置某些属性:

这些vmr属性用于由配置服务器设置。

我有什么明显的遗漏吗?任何故障排除的想法?

谢谢!

=============更新=================

0 投票
0 回答
190 浏览

java - Spring Cloud 配置服务器 aws codecommit - git-upload-pack 不允许

我使用 aws codecommit 作为 repoconfig-repo

我在连接到 git(codecommit) 后端时遇到了间歇性问题。

当我尝试使用 Git 凭证连接时,它可以工作,但不能使用 IAM 访问权限和密钥。它说git upload pack not permitted

但有一段时间它适用于 IAM 访问和密钥,而不适用于 Git 凭证,反之亦然。

错误日志

根据官方文档,它说

如果您通过 AWS CodeCommit URI 提供用户名和密码,则它们必须是提供对存储库的访问权限的 AWS accessKeyId 和 secretAccessKey。如果您未指定用户名和密码,则使用 AWS 默认凭证提供程序链检索 accessKeyId 和 secretAccessKey。

应用程序.yml

我能够使用它们中的任何一个运行该应用程序,但它同时停止工作,我无法弄清楚它为什么不能使用 IAM 凭证的原因。

依赖版本

  • 弹簧引导启动器父:2.3.2.RELEASE
  • 弹簧云依赖项:Hoxton.SR7
  • 弹簧云配置:2.2.4.RELEASE