Field iUserFeignService in com.alm.pc.platform.controller.UserLoginController required a bean of type ‘com.alm.youcanbe.user.feign.IUserFeignService’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
项目使用springcloud,openfeign调用服务接口时,出现以上报错,bean注入失败,ioc里面没有创建bean,有几个可能
一:服务接口没有加注解@Service 或者 @Component其中一个,ioc无法识别到接口。
二:启动类没加注解@ComponentScan(basePackages = {"******"})
三:feign接口的fallback函数没有对应的回调方法
四:feign接口无@FeignClient注解