解决:hystrix.stream访问出现404问题
作者:互联网
原因:springboot版本问题 解决:在启动类增加下面代码,然后重新启动项目 package com.forezp; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableEurekaClient @EnableHystrix @EnableHystrixDashboard public class EurekaRibbonClientApplication { public static void main(String[] args){ SpringApplication.run(EurekaRibbonClientApplication.class, args); } @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.e-learn.cn/topic/2232343
标签:registrationBean,hystrix,stream,springframework,404,HystrixMetricsStreamServlet, 来源: https://www.cnblogs.com/tszr/p/16517976.html