美文网首页SpringCloud
Spring Cloud @FeignClient 同一个服务注

Spring Cloud @FeignClient 同一个服务注

作者: 赛亚人之神 | 来源:发表于2019-05-13 21:12 被阅读0次

问题描述:多个接口上的@FeignClient(“相同服务名”)会报错,overriding is disabled。

使用的版本 SpringBoot: 2.1.4.RELEASE,SpringCloud: Greenwich.SR1,OpenFeign: 2.1.1.RELEASE

The bean 'eureka-provider.FeignClientSpecification', defined in null, could not be registered. 
A bean with that name has already been defined in null and overriding is disabled.

解决办法1:
在 application.yml 中添加

spring:
  main:
    allow-bean-definition-overriding: true

解决办法2:
http://cloud.spring.io/spring-cloud-static/Edgware.SR2/single/spring-cloud.html#_creating_feign_clients_manually

参考连接:

  1. https://blog.csdn.net/u012211603/article/details/84312709
  2. https://blog.csdn.net/neosmith/article/details/82349449
  3. https://www.jianshu.com/p/16a526379e8f

相关文章

网友评论

    本文标题:Spring Cloud @FeignClient 同一个服务注

    本文链接:https://www.haomeiwen.com/subject/rbhdaqtx.html