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

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

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


   org.springframework.cloud
   spring-cloud-starter-feign

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

后来引入


   org.springframework.cloud
   spring-cloud-openfeign-core
   2.0.0.RC2

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

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包换为


   org.springframework.cloud
   spring-cloud-starter-openfeign
   2.0.0.RC1
问题解决

你可能感兴趣的:(SpringCloud)