Spring cloud Hystrix仪表盘之Unable to connect to Command Metric Stream.

springboot 2.0需要添加 ServletRegistrationBean 因为springboot的默认路径不是 “/hystrix.stream”,只要在自己的项目里配置上下面的servlet就可以了

@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;
    }

参考文章:https://www.cnblogs.com/mark7/p/8920288.html

点赞