参考:http://www.cnblogs.com/wangdaijun/p/8891220.html
参考:https://www.cnblogs.com/java-zhao/p/5813439.html
由此可知,添加servlet:

package com.xxx.firstboot.hystrix.dashboard;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
@Configuration
public class HystrixConfig {
@Bean
public HystrixMetricsStreamServlet hystrixMetricsStreamServlet(){
return new HystrixMetricsStreamServlet();
}
@Bean
public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet){
ServletRegistrationBean registrationBean = new ServletRegistrationBean();
registrationBean.setServlet(servlet);
registrationBean.setEnabled(true);//是否启用该registrationBean
registrationBean.addUrlMappings("/hystrix.stream");
return registrationBean;
}
}

本文介绍了如何在Spring Boot应用中添加Hystrix仪表盘功能,通过配置自定义的Servlet来实现监控指标的实时更新。具体步骤包括创建HystrixMetricsStreamServlet实例,并通过ServletRegistrationBean设置URL映射。
4909

被折叠的 条评论
为什么被折叠?



