• RemoteFallbackFactory扫包:No fallbackFactory instance of type class


    调用feign接口出现 : FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com*********RemoteFallbackFactory found for feign client appid

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com*********Remote': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com*********RemoteFallbackFactory found for feign client appid
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1645)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1184)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)

    ... 32 common frames omitted

    原因:

    需要在FallBackFActory中添加 

    @Component注解
    @Component
    @Slf4j
    public class AAARemoteFallbackFactory implements FallbackFactory<AAARemote> {
    @Override
    public AAARemote create(Throwable cause) {
    return new AAARemote() {
    @Override
    public BizResponse<AAAResponse> getFunction(@RequestBody AAARequest request) {
    log.error("AAARemoteFallbackFactory getAAARemote params:{} error:{}", JSON.toJSONString(request),JSON.toJSONString(cause.getMessage()));
                    return new Response(ERROR.CODE);
    }

    };
    }
    }


     

    AAA
    团队五人,专业从事软件开发,接单工作,专注于Java,.Net,PHP
  • 相关阅读:
    DFS 算法总结
    拆分Cocos2dx渲染部分代码
    [OpenGL]纹理贴图实现 总结
    [LeetCode] Minimum Size Subarray Sum 最短子数组之和
    LRU Cache 题解
    Substring with Concatenation of All Words 题解
    multimap和multiset 认知和使用
    OpenGL ES 3.0 基础知识
    Cocos2dx坐标转换
    视图
  • 原文地址:https://www.cnblogs.com/xiaohouye/p/14735161.html
Copyright © 2020-2023  润新知