springcloud版本:Finchley.SR2
springboot版本:2.0.7.RELEASE
1.@EnableFeignClients @FeignClient注解找不到問(wèn)題
問(wèn)題原因: finchley版本feign相關(guān)jar包在openfeign包中
解決方案:pom.xml增加相關(guān)依賴
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
2.配置好feign相關(guān)注解后,項(xiàng)目啟動(dòng)時(shí)OpenFeign模塊報(bào)錯(cuò)
異常信息:
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!)
問(wèn)題原因:openFeign里不包含tomcat的依賴陶衅,導(dǎo)致spring容器無(wú)法創(chuàng)建一些實(shí)例活逆,導(dǎo)致項(xiàng)目無(wú)法啟動(dòng)砾赔。
解決方案:pom.xml中增加web依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>