springboot 抽取feign组件作为jar包依赖注入失败
报错信息:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field *Feign in *.memberservice.service.impl.WebServiceImpl required a bean of type 'com.*.feign.*Feign' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type '*.*
.*Feign' in your configuration.
Process finished with exit code 1
原因是:
@EnableFeignClients会覆盖了@ComponentScan,导致@ComponentScan的扫包失败
解决方法:
在@EnableFeignClients中加入扫描包的操作
@EnableFeignClients(basePackages = {"com.*.**feign"})