伪装客户和属性名称 [英] Feign Client and name from properties

查看:105
本文介绍了伪装客户和属性名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的事情

@FeignClient(name = "${airport.service.name}")

我有类似的编译错误,

java.lang.IllegalStateException:服务ID不是合法的主机名($ {airport.service.name})

java.lang.IllegalStateException: Service id not legal hostname (${airport.service.name})

问题是如何将主机名形式applciation.yaml传递给FeignClient?

The question is how can I pass hostname form applciation.yaml to FeignClient?

推荐答案

尽管很晚,但由于在使用假冒客户端时遇到此异常(java.lang.IllegalStateException:服务ID不是合法的主机名),所以我正在更新答案.春天的云 根本原因是伪装客户不接受分数低于的服务名称,请通过以下链接访问.为了解决此问题,我使用假冒(school-service)代替了understore(school_service)重命名了假冒客户要使用的服务名称

Though it is late, I am updating my answer since I faced this exception (java.lang.IllegalStateException: Service id not legal hostname) while using feign client in spring cloud The root cause is feign client won't accept service name with under score, Please go through the below link. To resolve this issue I renamed the service name to be used by feign client with hypen(school-service) instead of understore(school_service)

Github链接-spring-cloud-netflix-问题 Github链接-spring-cloud-netflix-提交

这篇关于伪装客户和属性名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆