通过GitLab获取属性时,Spring Boot Config服务器无法使用包含“-”的应用程序名称

问题描述

尝试从GitLab获取属性时,我无法在Spring Boot配置客户端中加载配置属性。

我在客户端bootstrap.properties中维护了以下属性。

spring.cloud.config.uri=http://localhost:8888
spring.application.name=my-first-app
spring.config.name=configClient
spring.cloud.config.enabled=true
management.endpoints.web.exposure.include=*
server.port=8080
spring.profiles.active=dev

但是当我保持如下状态时:

spring.application.name=myfirstapp

它完全可以正常工作,并且所有属性都已加载。确认一下,我在Gitlab中保留了2个不同的属性文件:

my-first-app-dev.properties
myfirstapp-dev.properties

我需要从 my-first-app-dev.properties 访问属性。
尝试使用http:// localhost:8888 / my-first-app / dev

访问时,我得到以下输出
{
 "name": "my-first-app","profiles": [
  "dev"
 ],"label": null,"version": "219ad52a2af5614a2b9e60ec21899f0f1c1cd2d1","state": null,"propertySources": []
}

这意味着当Spring应用程序名称包含“-”时,Spring Boot配置服务器未加载属性。
有关如何处理此问题的任何建议将大有帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)