千家信息网

SpringCloud Feign消费Eureka服务报错

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,SpringCloud Feign消费Eureka服务报com.netflix.client.ClientException: Load balancer does not have availabl
千家信息网最后更新 2025年02月02日SpringCloud Feign消费Eureka服务报错

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


@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})@ComponentScan(basePackages = "com.XXX")@Slf4j@Configuration@EnableScheduling@EnableTransactionManagement@EnableEurekaClient@EnableFeignClients(basePackages = "com.XXX.client")


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


@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})@ComponentScan(basePackages = "com.XXX")@Slf4j@Configuration@EnableScheduling@EnableTransactionManagement@EnableEurekaClient@EnableFeignClients(basePackageClasses = {com.XXX.client.base.AccountClient.class,        com.XXX.client.base.ExchangeOtcClient.class,        com.XXX.client.mkt.MktClient.class})


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


0