SpringCloud項目搭建完成后,客戶端向Eureka server注冊,報錯如下,顯示注冊404:
com.netflix.discovery.DiscoveryClient :DiscoveryClient_/MODULE-B/10.87.3.103:/module-b:8762 - Re-registering apps//MODULE-B
com.netflix.discovery.DiscoveryClient : DiscoveryClient_/MODULE-B/10.87.3.103:/module-b:8762: registering service...
com.netflix.discovery.DiscoveryClient : DiscoveryClient_/MODULE-B/10.87.3.103:/module-b:8762 - registration status: 404
在客戶端向注冊中心注冊時,注冊狀態為404,查看注冊中心時也不顯示該實例,檢查application.properties配置文件中:
查看spring.application.name = module-b 是否寫成spring.application.name = /module-b
注意:springcloud中聲明的name前面不能 加反斜線;在client向注冊 中心注冊服務時 ,或自動在聲明的name前面加上"/"。
本次問題去掉反斜線后解決。
