【发布时间】:2022-01-30 12:52:47
【问题描述】:
我刚刚将我们的 Spring Boot 项目升级到 v2.6.2 from boot 和 2021.0.0 from spring cloud。
现在我的远程配置获取没有任何效果,并且应用程序没有获取正确的属性文件
[main] INFO o.s.c.c.c.ConfigServicePropertySourceLocator - 从服务器获取配置:http://localhost:8080
[main] WARN o.s.c.c.c.ConfigServicePropertySourceLocator - 找不到 PropertySource:无法提取响应:没有找到适合响应类型 [class org.springframework.cloud.config.environment.Environment] 和内容类型 [text/html;charset] 的 HttpMessageConverter =UTF-8]
[main] INFO eu.hermes.esb.cloud.Application - 未设置活动配置文件,回退到默认配置文件:默认
[main] INFO o.s.b.c.config.ConfigDataLoader - 从服务器获取配置:http://localhost:8080
[main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - 在默认模式下引导 Spring Data JPA 存储库。**
我们使用基于 git repo 的 spring cloud config,它在以下结构中填充了我们的配置 yml 文件。
- app-one-dev.yml
- app-one-prod.yml
- app-two-dev.yml
- app-two-prod.yml 等等
我尝试按照一些答案的建议将这两个依赖项添加到客户端服务,但没有任何效果。
- spring-cloud-starter-config
- spring-cloud-starter-bootstrap
这是我的配置服务 yml:
spring.cloud.config.server:
git:
uri: https://bitbucket-prod.doa.otc.hlg.de/scm/inp-cloud/esb-spring-boot-config.git
username: foo
password: bar
force-pull: true
spring.security:
basic:
enabled: true
user:
name: inp
password: hermes
我的应用程序使用以下属性运行:
-Dspring.config.import=configserver:http://inp:hermes@localhost:8080
-Dspring.cloud.config.name=esb-config-service
-Dspring.cloud.config.username=foo
-Dspring.cloud.config.username=bar
-Dspring.application.name=app-one
-Dspring.profiles.active=dev,console,gelf
我们的服务在 OKD 的 Kubernetes 上运行。但我在 Windows 机器上本地复制了相同的情况,所以我认为它不是特定于环境的。
【问题讨论】:
标签: spring-boot spring-cloud java-11 spring-cloud-config