1. 程式人生 > >spring cloud 的斷路器(Hystrix) 依賴添加註意點

spring cloud 的斷路器(Hystrix) 依賴添加註意點

最新的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>