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>
网友评论