美文网首页
spring cloud2 hystrix没有hystrix.s

spring cloud2 hystrix没有hystrix.s

作者: running_house | 来源:发表于2018-07-17 11:53 被阅读0次

第一步:在启动类上引入

@EnableHystrix 或者 @EnableCircuitBreaker ,表示启用熔断器

第二步:在启动类中加入如下代码

    @Bean
    public ServletRegistrationBean getServlet(){

        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);  //系统启动时加载顺序
        registrationBean.addUrlMappings("/hystrix.stream");//路径
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }

这样就可以直接使用 http://localhost:8080/hystrix.stream查看监控信息

相关文章

网友评论

      本文标题:spring cloud2 hystrix没有hystrix.s

      本文链接:https://www.haomeiwen.com/subject/wfpwpftx.html