springcloud feign报错

springcloud版本:Finchley.SR2
springboot版本:2.0.7.RELEASE

1.@EnableFeignClients @FeignClient注解找不到问题

问题原因: finchley版本feign相关jar包在openfeign包中
解决方案:pom.xml增加相关依赖

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

2.配置好feign相关注解后,项目启动时OpenFeign模块报错

异常信息:

org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name ‘eurekaAutoServiceRegistration‘: Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

问题原因:openFeign里不包含tomcat的依赖,导致spring容器无法创建一些实例,导致项目无法启动。
解决方案:pom.xml中增加web依赖

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容