带有绝对URL的FeignClient在Hoxton中使用Spring Cloud Loadbalancer无效。

时间:2019-11-30 10:45:32

标签: spring-cloud

我有一个带有绝对主机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

依赖项

  • Spring Boot 2.2.1
  • Spring Cloud Hoxton.RELEASE

更新2019年12月21日

此错误(https://github.com/spring-cloud/spring-cloud-openfeign/issues/259)已在Spring Boot 2.2.2.RELEASE和Spring Cloud Hoxton.SR1中修复

Loadbalancer在此版本中可以正常工作。

0 个答案:

没有答案