SpringCloud dashboard ping 一直为空 和 仪表盘一直为loading状态
原因:
springboot2.0+ 的 dashboard 的默认路径不是"/hystrix" 需添加的一个servlet,否则会连接不上 注意:这些全是配在Feign端即可(即配网关服务)
解决方案:
1、添加如下配置到容器
@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;
}
2、其次需在application.yml 全局配置文件中开启feign的熔断
feign:
hystrix:
enabled: true