springcloud feign報錯

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

1.@EnableFeignClients @FeignClient注解找不到問題

問題原因: 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)注解后,項目啟動時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容器無法創(chuàng)建一些實例,導致項目無法啟動。
解決方案:pom.xml中增加web依賴

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容