2.feign报错
今天发现代码调用远程一直找不到bean,仔细查看了依赖也已经注入了,可就是找不到!
一直报:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wmNewsAutoScanServiceImpl': Unsatisfied dependency expressed through field 'articleClient'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'apis.article.IArticleClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
后来发现是以下问题:
1.feign下的包名不符合规范
必须要和其他的相同: com...*...
2.调用feign的要使用feign的启动类上没有添加注解
并且,加上强行扫描,这样就不会找不到了