若依微服务使用openfeign ,写了一个接口,但是其他项目引入的时候显示找不到这个Bean:Could not autowire. No beans of 'RemoteHouseService' type found.

启动报错:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tokenController': Unsatisfied dependency expressed through field 'sysLoginService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysLoginService': Unsatisfied dependency expressed through field 'remoteHouseService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tsthbpom.system.api.RemoteHouseService': Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com.tsthbpom.system.api.factory.RemoteHouseFallbackFactory found for feign client remoteHouseServ

 

 

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysLoginService': Unsatisfied dependency expressed through field 'remoteHouseService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tsthbpom.system.api.RemoteHouseService': Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com.tsthbpom.system.api.factory.RemoteHouseFallbackFactory found for feign client remoteHouseService

 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tsthbpom.system.api.RemoteHouseService': Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: No fallbackFactory instance of type class com.tsthbpom.system.api.factory.RemoteHouseFallbackFactory found for feign client remoteHouseService

 

 

Caused by: java.lang.IllegalStateException: No fallbackFactory instance of type class com.tsthbpom.system.api.factory.RemoteHouseFallbackFactory found for feign client remoteHouseService

 

 

idea 中代码提示:

Could not autowire. No beans of 'RemoteFileService' type found. 

 

1.在系统接口api 中写了调用 house 服务的接口

2.在score 服务中,引入api,使用openfeign 调用house中的接

 

 

3.注入的是自己新写的remoteHouseService不行,但是原来的remoteFileService 就可以 

 

4.api 自动配置文件中 加入新写的接口

 

 

 

参考:

springboot自动装配原理

【Spring Boot】自动配置及重要注解解析

 

[Java] Spring Boot Auto Configure(Spring Boot自动装配)的原理

 

若依微服务框架两个服务之间调用-参考ruoyi-api-system

posted @ 2023-07-13 09:13  BBS_自律  阅读(1045)  评论(0编辑  收藏  举报