spring cloud 的断路器(Hystrix) 依赖添加注意点

本文介绍了如何通过不同的依赖配置方式来启用Spring Cloud中的Hystrix断路器功能及其仪表盘。提供了两种配置方案:一是引入Spring Cloud Netflix Hystrix相关的启动器依赖;二是单独添加Hystrix核心库依赖。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最新的Hystrix 依赖都是隶属于netfix下,这样@HystrixCommand 和@EnableHystrixDashboard 才能使用

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

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

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

或者添加下面两个依赖,也可以使用@HystrixCommand

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值