Spring-cloud-netflix: How to use Hystrix in Feign?

Created on 11 Sep 2017  Â·  8Comments  Â·  Source: spring-cloud/spring-cloud-netflix

Most helpful comment

I've had the same problem as you, but I've solved it now.

First

Add the configuration below to your application.properties
@eacdy

If you're using Spring Cloud Daslston or above.
Maybe you missed configuration feign.hystrix.enabled=true

Second

Just do first is not enough, you need also add Hystrix dependence to the pom.xml

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

You can find these in the Spring Cloud Netflix official document at http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign-hystrix


I had saw your profile and i knew you are a Chinese, So i recommend this article for you. It's maybe helpful.

All 8 comments

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Sep 11 11:08:12 CST 2017
There was an unexpected error (type=Internal Server Error, status=500).
Connection refused: connect executing GET http://service-test/hello?name=Chrome

If you're using Spring Cloud Daslston or above.
Maybe you missed configuration feign.hystrix.enabled=true.

The version is Dalston.SR3.But it does not contain configuration :feign.hystrix.enabled=true.

Please provide more information about what the issue is and a sample project the reproduces the issue.

@CHERRISHGRY It does. Please check the class file FeignClientsConfiguration in an IDE of your choice.

I've had the same problem as you, but I've solved it now.

First

Add the configuration below to your application.properties
@eacdy

If you're using Spring Cloud Daslston or above.
Maybe you missed configuration feign.hystrix.enabled=true

Second

Just do first is not enough, you need also add Hystrix dependence to the pom.xml

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

You can find these in the Spring Cloud Netflix official document at http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign-hystrix


I had saw your profile and i knew you are a Chinese, So i recommend this article for you. It's maybe helpful.

@YrlixJoe you are right,but confused.If you're using Spring Cloud Daslston or above. you also can use feign.hystrix.enabled=true,although the application.yml can't automatic discovery it

Add the configuration to application.properties。 it work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpuigsegur picture jpuigsegur  Â·  4Comments

jabrena picture jabrena  Â·  4Comments

jjparsons picture jjparsons  Â·  3Comments

importsource picture importsource  Â·  4Comments

todd-wang-in-BJ picture todd-wang-in-BJ  Â·  3Comments