'feign.FeignContext' that could not be found

柔情只为你懂 2022-05-24 06:50 448阅读 0赞

在Spring Cloud Zuul中加入Feign,报如下错误:

A component required a bean of type ‘org.springframework.cloud.netflix.feign.FeignContext’ that could not be found.
- Bean method ‘feignContext’ not loaded because @ConditionalOnClass did not find required class ‘feign.Feign’

从以下两个方面Check:

I.在pom文件中引入下面的jar:

  1. <dependency>
  2. <groupId>org.springframework.cloud</groupId>
  3. <artifactId>spring-cloud-starter-feign</artifactId>
  4. </dependency>

II. 在启动类main方法上加入Feign注解:

  1. @EnableFeignClients

发表评论

表情:
评论列表 (有 0 条评论,448人围观)

还没有评论,来说两句吧...

相关阅读