springcloud feign报错

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

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

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


  org.springframework.cloud
  spring-cloud-starter-openfeign

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依赖


  org.springframework.boot
  spring-boot-starter-web

你可能感兴趣的:(springcloud feign报错)