美文网首页
11,Feign报错'xx.FeignClientSpe

11,Feign报错'xx.FeignClientSpe

作者: 滔滔逐浪 | 来源:发表于2019-01-20 13:45 被阅读17次

    错误描述:
    版本使用的是SpringBoot: 2.1.0.RELEASE,SpringCloud: Greenwich.M1,OpenFeign: 2.1.0.M2
    报错:

    The bean 'xxxx.FeignClientSpecification', defined in null, could not be registered. 
    A bean with that name has already been defined in null and overriding is disabled.
    
    Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: 
    Invalid bean definition with name xxxx.FeignClientSpecification' defined in null: 
    Cannot register bean definition [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'xxxx.FeignClientSpecification': There is already [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] bound.
    

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

    在application.yml中配置:

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

    相关文章

      网友评论

          本文标题:11,Feign报错'xx.FeignClientSpe

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