我正在使用 spring cloud consul 注册我的服务,但它总是会替换 . to - 在注册之前,像这样:
我的应用程序名称:com.test.app
领事中的名字:com-test-app
我试过spring.application.name
& spring.cloud.consul.discovery.service-name
,它们是一样的。
有谁知道如何避免这种转换?
非常感谢。
========================================
2017 年 6 月 23 日更新:
我试过用curl注册consul,它支持这个,所以我猜是转换是spring cloud的限制,请帮忙!
pansion@server ~ -> curl -XPUT 127.0.0.1:8500/v1/agent/service/register -d '{ "ID": "test_001", "Name":"com.test.app", "Address": "10.0.0.10", "Port": 8080 }'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 81 0 0 100 81 0 81 0:00:01 --:--:-- 0:00:01 81000
pansion@server ~ ->
pansion@server ~ -> curl 127.0.0.1:8500/v1/catalog/services
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45 100 45 0 0 45 0 0:00:01 --:--:-- 0:00:01 45000{
"com.test.app": [],
"consul": []
}
pansion@server ~ ->
pansion@server ~ -> curl 127.0.0.1:8500/v1/catalog/service/com.test.app
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 551 100 551 0 0 36733 0 --:--:-- --:--:-- --:--:-- 36733[
{
"ID": "3789117d-a44e-c82b-07dd-b386a1f2eeef",
"Node": "server",
"Address": "127.0.0.1",
"Datacenter": "dc1",
"TaggedAddresses": {
"lan": "127.0.0.1",
"wan": "127.0.0.1"
},
"NodeMeta": {},
"ServiceID": "test_001",
"ServiceName": "com.test.app",
"ServiceTags": [],
"ServiceAddress": "10.0.0.10",
"ServicePort": 8080,
"ServiceEnableTagOverride": false,
"CreateIndex": 12,
"ModifyIndex": 12
}
]
pansion@server ~ ->