Hystrix is to achieve the role is to achieve the call when the call service is unavailable downgrade, such as return to a friendly tips
feign configuration using hystrix
If you are using feign declarative call, then feign default integrated hystrix, just write feign client fallbalk class and configure it
For example, there is a xxxFeignClient, write fallbalk xxxFeignClient of a class:
@Component
public class xxxFeignClientFallback implements xxxFeignClient {
}
() To add annotations in brackets in xxxFeignClient of @FeignClient:
fallback = xxxFeignClientFallback.class
Add annotations on the boot class call
@EnableFeignClients
If not started xxxFeignClient current packet or a sub-class of the current packet following the packet, and its fallbalk such xxxFeignClient com.xxx.client package classes in the following, based on the caller's start com.xxx.ui package below, the We need to add the following annotation on the class started off with a party:
@ComponentScan(basePackages = {"com.xxx.ui","com.xxx.client"})
@EnableFeignClients(basePackages = {"com.xxx.client"})
Note: Only scan the specified basePackages specified package when the project started after the specified component basePackages
Finally application.properties file caller added to enable feign hystrix configuration:
feign.hystrix.enabled=true