SpringCloud消费者报错:'org.springframework.cloud.openfeign.FeignContext' that could not be found.

springboot版本:2.0.2.RELEASE,springcloud版本:Finchley.RC2

在使用Feign消费服务者时,首先引入feign的jar包

<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-feign</artifactId>
</dependency>

然后在入口类中加入注解@EnableFeignClients,但是却引不进来

后来引入

<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-openfeign-core</artifactId>
   <version>2.0.0.RC2</version>
</dependency>

注解成功引入,但是启动报错:

2018-06-20 19:33:53.799 ERROR 20984 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
***************************
APPLICATION FAILED TO START
***************************
Description:
Field productClient in com.zsl.order.controller.OrderController required a bean of type 'org.springframework.cloud.openfeign.FeignContext' that could not be found.
- Bean method 'feignContext' not loaded because @ConditionalOnClass did not find required class 'feign.Feign'
Action:

Consider revisiting the conditions above or defining a bean of type 'org.springframework.cloud.openfeign.FeignContext' in your configuration.

报错原因:jar包引入错误

解决方法:

将openfeign的jar包换为

<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-openfeign</artifactId>
   <version>2.0.0.RC1</version>
</dependency>
问题解决
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值