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})
为什么会这样,我还没搞明白,先记录下.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/193290.html