【问题标题】:in Spring Cloud Config, how does curl client works?在 Spring Cloud Config 中,curl 客户端如何工作?
【发布时间】:2021-01-13 01:30:06
【问题描述】:

在我的仓库中,有三个文件:config-client-dev.properties、config-client-prod.properties 和 config-client.properties。

我使用 curl 喜欢:

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

我得到的结果是这样的:

{"name":"config-client","profiles":["prod"],"label":"master","version":null,"state":null,"propertySources":[] }

有没有办法获取属性文件中的值?

【问题讨论】:

标签: spring-boot spring-cloud spring-cloud-config


【解决方案1】:

你的结果

{
   "name":"config-client",
   "profiles":[
      "prod"
   ],
   "label":"master",
   "version":null,
   "state":null,
   "propertySources":[
      
   ]
}

这是错误的。你必须打电话

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

(去掉分支名称master)

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

【讨论】:

    猜你喜欢
    • 2020-06-27
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    • 1970-01-01
    • 2020-01-21
    • 1970-01-01
    • 2017-01-21
    • 2016-11-25
    相关资源
    最近更新 更多