标签:object mamicode cpe 回调 RoCE int ebe trade cep
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.bwton.tradecenter.tdbd.api.om.interfaces.BizOrderAccpetAPI‘: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Incompatible fallback instance. Fallback/fallbackFactory of type class com.bwton.tradecenter.tdbd.api.om.interfaces.TdbdOrderFallbackFactory is not assignable to interface com.bwton.tradecenter.tdbd.api.om.interfaces.BizOrderAccpetAPI for feign client tdbd-om-service at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 32 common frames omitted Caused by: java.lang.IllegalStateException: Incompatible fallback instance. Fallback/fallbackFactory of type class com.bwton.tradecenter.tdbd.api.om.interfaces.TdbdOrderFallbackFactory is not assignable to interface com.bwton.tradecenter.tdbd.api.om.interfaces.BizOrderAccpetAPI for feign client tdbd-om-service at org.springframework.cloud.netflix.feign.HystrixTargeter.getFromContext(HystrixTargeter.java:100) at org.springframework.cloud.netflix.feign.HystrixTargeter.targetWithFallback(HystrixTargeter.java:85) at org.springframework.cloud.netflix.feign.HystrixTargeter.target(HystrixTargeter.java:49) at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:145) at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:166) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) ... 42 common frames omitted
今天使用feign时 遇到一个问题 消费者启动一直报bean找不到
网上找了一下,大部分都说启动类@SpringBootApplication没有扫描到接口类所在包,但是我按照上面说的依旧没成功。
直到后来发现我的问题错在哪里
错误展示:
接口:
回调:
错误原因:
fallback类型时 对应回调应该是实现BizOrderAccpetAPI接口 ,重写方法
fallbackFactory类型时 对应回调应该是实现FallbackFactory<BizOrderAccpetAPI>接口,重写方法
正确配置:
第一种方式:fallback
接口:
回调:
第二种方式:fallbackFactory
接口:
回调:
特此记录
标签:object mamicode cpe 回调 RoCE int ebe trade cep
原文地址:https://www.cnblogs.com/lxk233/p/11419295.html