“Spring Cloud Hystrix 断路器”

Hystrix可以收集每个断路器(以HystrixCommand注解的)的运行状态, 由 Hystrix Dashboard 以界面化的方式进行展示。

1、需要的依赖:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-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-hystrix-dashboard</artifactId>
</dependency>

2、加上@EnableHystrixDashboard注解

3、 启动工程后访问:http://localhost:8080/hystrix,输入http://localhost:8080/hystrix.stream,点击按钮“Monitor Stream”,即可进入Hystrix Dashboard,此时进去面板显示“Loading …”,需要在新的浏览器窗口中访问由@HystrixCommand注解的请求(http://localhost:8080/hello/world),即可。

转载请注明出处:http://www.iyujian.me/java/spring-cloud-hystrix-dashboard.html