如何在多个假客户端之一中禁用 hystrix [英] How to disable hystrix in one of multiple feign clients

查看:26
本文介绍了如何在多个假客户端之一中禁用 hystrix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Spring Boot 应用程序中,我使用了多个 feign 客户端 (@FeignClient("hello-service")).在很多情况下,我需要一个断路器机制,所以我有以下配置.

In my spring boot application I use multiple feign clients (@FeignClient("hello-service")). In the case of many of them, I need a mechanism of circuit breaker, so I have following line to the configuration.

feign.hystrix.enabled=true

feign.hystrix.enabled=true

但是我不知道如何配置特定的 feign 客户端不使用 Hystrix.有可能吗?有没有人设法以这种方式配置 spring 应用程序?

However I'don't know how I can configure specific feign client not to use Hystrix. Is it possible? Has anyone managed to configure the spring applications in this way?

推荐答案

您可以创建自己的配置并禁用 hystrix 功能,并将其用于必要的客户端.

You can create you own configuration with disabled hystrix functionality, and use it for necessary clients.

public class FeignClientConfiguration {
@Bean
@Scope("prototype")
public Feign.Builder feignBuilder() {
    return Feign.builder();
}
}

详情见第 7.4 段

这篇关于如何在多个假客户端之一中禁用 hystrix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆