openfeign接口启动报错: is not assignable to interface feign.hystrix.FallbackFactory

  • 报错详情:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘goodsController’: Unsatisfied dependency expressed through field ‘wareHouseOpenFienService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.changgou.service.goods.service.openfien.WareHouseOpenFienService’: Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: Incompatible fallbackFactory instance. Fallback/fallbackFactory of type class com.changgou.service.goods.service.openfien.WareHouseOpenFienServiceFallbackFactory is not assignable to interface feign.hystrix.FallbackFactory for feign client wareHouseOpenFienService

从报错中可以看出: is not assignable to interface feign.hystrix.FallbackFactory 提示不能分配给接口false .hystrix. fallbackfactory

  • 接口代码:
@FeignClient(name = "wareHouseOpenFienService",url = "http://127.0.0.1:9101/changgou-warehouse",fallbackFactory = WareHouseOpenFienServiceFallbackFactory.class)
public interface WareHouseOpenFienService {/*** 根据商品id集合查询库存信息* @param goodsIds* @return*/@PostMapping(value = "/queryListByGoodsIds")R<List<Warehouse>> queryListByGoodsIds(@RequestBody List<Long> goodsIds);
}

可以看到接口配置了fallbackFactory接口

  • WareHouseOpenFienServiceFallbackFactory代码:
@Component
public class WareHouseOpenFienServiceFallbackFactory implements FallbackFactory<WareHouseOpenFienService> {@Overridepublic WareHouseOpenFienService create(Throwable cause) {return goodsIds -> R.fail("调用查询库存信息接口失败:" + cause);}
}

从代码上看没有任何问题, 报错原因是因为WareHouseOpenFienServiceFallbackFactory中实现的FallbackFactory接口需要注意, 是feign.hystrix.FallbackFactory而不是org.springframework.cloud.openfeign.FallbackFactory 所以导包时需要注意:

是: import feign.hystrix.FallbackFactory;
而不是: import org.springframework.cloud.openfeign.FallbackFactory;

openfeign接口启动报错: is not assignable to interface feign.hystrix.FallbackFactory相关推荐

  1. SpringBoot 启动报错 Specified class is an interface

    springboot项目启动报错 Specified class is an interface 然后通过百度找到解决方案说项目中有重复命名的Mapper文件,修改文件名重启 但是按照解决方案重命名了 ...

  2. fagin 启动报错 Fallback/fallbackFactory

    Fallback/fallbackFactory of type class  is not assignable to interface feign.hystrix.FallbackFactory ...

  3. xcode高版本常见的RN本地启动报错

    xcode编译报错:'config.h' file not found 解决方案 cd node_modules/react-native/third-party/glog-0.3.4 ../../s ...

  4. 调用后台接口返回报错前端隐藏提示_腾讯社交联盟广告

    开发者帮助中心 优量汇服务体系升级了,除查阅本页常见问题外,还可以通过以下渠道解决您遇到的问题 1. 实时智能客服 入口:优量汇官网.开发者平台.优量汇服务号 时间:7*24即时问答 服务内容:涵盖 ...

  5. Spring项目启动报错No qualifying bean of type [xxx] available: expected single matching bean but found 2

    启动报错: No qualifying bean of type [class1] available: expected single matching bean but found 2,class ...

  6. mysql启动失败LSB_mysql启动报错:Failed to start LSB: start and stop MySQL

    报错信息: [root@youxx- bin]# service mysql status Redirecting to /bin/systemctl status mysql.service ¡ñ ...

  7. 【图文详解】SpringBoot项目启动报错:The bean ‘xxxServiceImpl‘ could not be injected as a ‘xxxServiceImpl‘ ...

    问题描述: 项目启动报错:The bean 'xxxServiceImpl' could not be injected as a 'cn.xxxx.service.xxxServiceImpl' b ...

  8. Spring循环引用-@Async注解启动报错,而@Transactional则不会

    目录 一.问题描述 二.问题分析 1.代理类 2.代理过程 三.结论 上接<Spring循环引用-@Async注解启动报错分析> 一.问题描述 Bean1Service注解@Async 启 ...

  9. 启动报错:Caused by: org.apache.ibatis.binding.BindingException汇总解决

    报错 Springboot启动时从nacos拉取配置.启动报错: Caused by: org.apache.ibatis.binding.BindingException: Invalid boun ...

最新文章

  1. 用Kubernetes部署超级账本Fabric的区块链即服务(1)
  2. 你真的理解零拷贝吗?
  3. java.lang.RuntimeException: can not run elasticsearch as root
  4. 修改Linux的基本配置(如主机名、ip等)
  5. Exchange 2003 OWA登陆非常慢!
  6. 利用Android 8.0 ShortcutManager创建桌面快捷图标
  7. 【UVA - 10891 Game of Sum 】【HRBUST - 1622】 Alice and Bob (区间dp,博弈问题)
  8. 蒙山中学网站的服务器,上海金山区蒙山中学
  9. Target runtime com.genuitec.runtime.generic.jee60 is not defined
  10. Abseil之拆分字符串
  11. vue.js 调用iOS原生方法,JavaScriptCore
  12. express入门学习(一)
  13. linux mysql 数据恢复_怎样恢复Mysql数据库误删除后的数据
  14. iOS 图片裁剪功能。
  15. js通过base64编码显示图片
  16. 网络维护汇总经典问题集
  17. OSPF你懂多少之经典问题50个
  18. android中的单位——pt
  19. js中的定时器和计时器使用
  20. 解决insmod error inserting 'hello ko' -1 Invalid module form

热门文章

  1. Spring Boot Web应用程序中注册 Servlet 的方法实例
  2. 13个可以激励自己的名言
  3. 将id=5以及emp_no=10001的行数据替换成id=5以及emp_no=10005
  4. python怎么找出最大数_python怎么找出最大数
  5. 操作系统第五章——进程同步
  6. 手机PDF如何转成PPT?操作方法如何?
  7. 将 MATLAB 搬到虚拟机
  8. 纯css实现文字跳动的动画效果
  9. Linux Shell中判断进程是否存在的代码
  10. 罗升阳:那两年炼就的Android内功修养