温馨提示×

SpringCloud Feign消费Eureka服务报错

发布时间:2020-07-08 12:12:30 来源:网络 阅读:4869 作者:liuhanling 栏目:软件技术

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})


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


免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。