No qualifying bean of type 'feign' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

问题:

刚用低代码平台引入的一个module,但是启动报错Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ServiceImpl' defined in file [ServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'feign' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

意思就是容器需要依赖feign的bean,但是没有找到。

思路:

1.查看了nacos,看看是否新生成的项目只想的工作空间对不对

2.自动装载的时候,有没有对feignClient做初始化

3.启动类是否扫描了feign所在的文件夹路径

 

解决:

排查后,发现是启动类中没有加EnableFeignClients注解,所以找bean的时候没找到,启动类增加@EnableFeignClients(basePackages = {"com.cloudoer"}) 搞定

posted @ 2024-08-21 10:22  蔡徐坤1987  阅读(61)  评论(0编辑  收藏  举报