Spring mvc &引用;Hystrix stream没有为我的spring mvc应用程序生成;

Spring mvc &引用;Hystrix stream没有为我的spring mvc应用程序生成;,spring-mvc,spring-cloud-netflix,Spring Mvc,Spring Cloud Netflix,我有一个简单的SpringMVC应用程序。对于该应用程序,我已经使用@enablecuirtbreaker注释实现了断路器模式。它工作得很好。但在尝试生成hystrix流时,它显示404错误。任何人都可以帮我解决这个问题。Hystrix流(/Hystrix.stream)只有在您具有spring启动执行器依赖项时才启用。请尝试将以下依赖项添加到pom或gradle构建文件中 org.springframework.boot:spring-boot-starter-actuator 更新日期:

我有一个简单的SpringMVC应用程序。对于该应用程序,我已经使用@enablecuirtbreaker注释实现了断路器模式。它工作得很好。但在尝试生成hystrix流时,它显示404错误。任何人都可以帮我解决这个问题。

Hystrix流(
/Hystrix.stream
)只有在您具有spring启动执行器依赖项时才启用。请尝试将以下依赖项添加到pom或gradle构建文件中

org.springframework.boot:spring-boot-starter-actuator

更新日期:2017/06/26

如果您的应用程序不基于spring boot,则需要自己配置
hystrixmetricstreamservlet
。因为/hystrix.stream是由spring cloud netflix自动配置的,它基于spring boot

首先,需要将
com.netflix.hystrix:hystrix metrics事件流的依赖项添加到应用程序中。
其次,您应该将
hystrixmetricstreamservlet
servlet导入
web.xml
中,如下所示

 <servlet>
    <description></description>
    <display-name>HystrixMetricsStreamServlet</display-name>
    <servlet-name>HystrixMetricsStreamServlet</servlet-name>
    <servlet-class>com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>HystrixMetricsStreamServlet</servlet-name>
    <url-pattern>/hystrix.stream</url-pattern>
</servlet-mapping

HystrixMetricsStreamServlet
HystrixMetricsStreamServlet
com.netflix.hystrix.contrib.metrics.eventstream.hystrixmetricstreamservlet
HystrixMetricsStreamServlet
/海斯特里克斯河

如果我将SpringBootStarterActuator放在pom.xml中,我的项目工件将失败。仅供参考:我的应用程序在Spring MVC中。没有启动依赖项。所以我添加了SpringBootStarterWeb,然后我在运行代码时遇到了问题。我更新了我的答案,因为您没有使用SpringBoot。