我有一个带有绝对主机URL的伪装客户端(目标主机未在eureka中注册)
@FeignClient(name = "feedback-client", url = "http://some.absolute.url")
interface FeedbackClient {
@RequestMapping(value = ["/feedback"], method = [RequestMethod.GET])
fun findAll(@RequestParam("page") page: Int): Page<Feedback>
}
在Spring Boot 2.2.1上一切正常,直到我使用application.yml
中的以下配置禁用功能区为止
spring:
cloud:
loadbalancer:
ribbon:
enabled: false
伪装客户端开始给出以下错误:
s.c.o.l.FeignBlockingLoadBalancerClient : Load balancer does not contain an instance for the service <absolute http url>
我尝试使用spring cloud loadbalancer
代替功能区,这导致了此问题。
我在build.gradle
compile('org.springframework.cloud:spring-cloud-starter-loadbalancer')
有帮助吗? Feign是否通过静态服务器列表支持spring cloud loadbalancer
?
Github Repo重现该场景:
https://github.com/cancerian0684/demo-openfeign
依赖项:
此错误(https://github.com/spring-cloud/spring-cloud-openfeign/issues/259)已在Spring Boot 2.2.2.RELEASE
和Spring Cloud Hoxton.SR1
中修复
Loadbalancer在此版本中可以正常工作。