在Spring Cloud Config中,curl客户端如何工作?

问题描述

在我的仓库中,有三个文件config-client-dev.propertiesconfig-client-prod.propertiesconfig-client.properties

我使用像这样的卷曲:

curl http://localhost:8888/config-client/dev/master
curl http://localhost:8888/config-client/prod/master
curl http://localhost:8888/config-client/default/master

我得到的结果是:

{“名称”:“配置客户端”,“配置文件”:[“产品”],“标签”:“主机”,“版本”:null,“状态”:null,“ propertySources”:[] }

有什么方法可以获取属性文件中的值?

解决方法

您的结果

curl http://localhost:8888/config-client/dev
curl http://localhost:8888/config-client/prod
curl http://localhost:8888/config-client/default

这是错误的。您必须致电

master

(删除分支ZlibDecoder的名称)

让我们看一下参考文档中的一个示例:https://docs.spring.io/spring-cloud-config/docs/2.2.5.RELEASE/reference/html/#_quick_start

enter image description here