zoukankan      html  css  js  c++  java
  • spring cloud hystrix dashboard 没有/actuator/hystrix.stream路径解决

    首先我用的是spring boot Greenwich.SR2

    在测试hystrix-dashboard监控服务时,发现访问localhost:9001/actuator/hystrix.stream一直失败

    去网上搜了一下,发现启动类要添加一个servlet

        @Bean
        public ServletRegistrationBean getServlet(){
            HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
            ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
            registrationBean.setLoadOnStartup(1);
            registrationBean.addUrlMappings("/actuator/hystrix.stream");
            registrationBean.setName("HystrixMetricsStreamServlet");
            return registrationBean;
        }

    要引入的依赖有以下

            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
                <version>2.1.2.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-openfeign</artifactId>
                <version>2.1.2.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-archaius</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
  • 相关阅读:
    关于APP接口设计
    http协议详解-摘抄
    lnmp启动脚本
    MySQL数据库优化总结
    91、sendToTarget与sendMessage
    90、 Android UI模板设计
    Android Intent Action大汇总(转载)
    89、Android EditText 悬浮停靠
    88、android 插件开发教程(转载)
    Android Studio实用插件使用
  • 原文地址:https://www.cnblogs.com/xc-chejj/p/11316143.html
Copyright © 2011-2022 走看看