SpringCloud Feign消费Eureka服务报错

水深无声 2022-01-17 03:43 579阅读 0赞

SpringCloud Feign消费Eureka服务报com.netflix.client.ClientException: Load balancer does not have available server for client: user

关于这个错误,网上一搜一大把,我抛出我遇到的问题

我把调用外部系统放在一个 client 的子model里头,用包扫描的方式

出现 Feign com.netflix.client.ClientException: Load balancer does not have available server for client: user

  1. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  2. @ComponentScan(basePackages = "com.XXX")
  3. @Slf4j
  4. @Configuration
  5. @EnableScheduling
  6. @EnableTransactionManagement
  7. @EnableEurekaClient
  8. @EnableFeignClients(basePackages = "com.XXX.client")

然后改成这种class扫描方式,运行调用OK

  1. @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
  2. @ComponentScan(basePackages = "com.XXX")
  3. @Slf4j
  4. @Configuration
  5. @EnableScheduling
  6. @EnableTransactionManagement
  7. @EnableEurekaClient
  8. @EnableFeignClients(basePackageClasses = {com.XXX.client.base.AccountClient.class,
  9. com.XXX.client.base.ExchangeOtcClient.class,
  10. com.XXX.client.mkt.MktClient.class})

为什么会这样,我还没搞明白,先记录下.

转载于:https://blog.51cto.com/5634409/2343542

发表评论

表情:
评论列表 (有 0 条评论,579人围观)

还没有评论,来说两句吧...

相关阅读