spring boot 2.1.X 版本中融合 Greenwich.M2 的 spring cloud

栏目: Java · 发布时间: 6年前

内容简介:}则需要去访问几次提供熔断的方法就可以解决了,因为现在我们还没有访问过熔断的方法,系统找不到数据。

spring boot 2.1.X 版本中融合 Greenwich.M2 的 spring cloud

一. feign + hystrix dashboard 整合

  1. gradle 中需要导入的依赖,( SpringCloudVersion = ‘2.1.0.M2’)

    dependencies {
        compile(
            "org.springframework.boot:spring-boot-starter-actuator",
            "org.springframework.cloud:spring-cloud-starter-openfeign:${SpringCloudVersion}",
            "org.springframework.cloud:spring-cloud-starter-netflix-hystrix:${SpringCloudVersion}",
            "org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard:${SpringCloudVersion}",
            "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:${SpringCloudVersion}"
        )

}

``
  1. 在主程序启动类中加入@EnableHystrixDashboard注解,开启hystrixDashboard。

    package pers.roamer.spring.cloud.feign.client;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.hystrix.EnableHystrix;
    import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
    import org.springframework.cloud.openfeign.EnableFeignClients;
    
    @SpringBootApplication
    @EnableHystrix
    @EnableHystrixDashboard
    @EnableFeignClients
    public class FeignClientApplication {
        public static void main(String[] args) {
            SpringApplication.run(FeignClientApplication.class, args);
        }
    }
  2. 在 此界面的 url 中录入 : http://127.0.0.1:8765/actuator/hystrix.stream

    注意: 在这里要加入actuator

  3. 如果这里出现 , Unable to connect to Command Metrix Stream.

    spring boot 2.1.X 版本中融合 Greenwich.M2 的 spring cloud

    需要在applicaiton.yaml 中加入下面一段:(注意最后的*一定要加上引号,不然会启动报错。)

    #解决 在 spring boot 2.0 下 hystrix.stream 404的错误
    management:
        endpoints:
            web:
                exposure:
                    include: '*'
  4. 如果一直出现 loading 的界面。

    spring boot 2.1.X 版本中融合 Greenwich.M2 的 spring cloud

则需要去访问几次提供熔断的方法就可以解决了,因为现在我们还没有访问过熔断的方法,系统找不到数据。


以上所述就是小编给大家介绍的《spring boot 2.1.X 版本中融合 Greenwich.M2 的 spring cloud》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

不止情感设计

不止情感设计

陈华 / 电子工业出版社 / 2015-5-21 / 59.00

本书着眼于“设计&心理”两个主要的维度,围绕“创新式思维2.0”(共情—移情—定义—构思—建模—测试)的模式,分析如何“理解一款好的产品设计”、“如何了解用户需求”、“如何从需求来定义产品”的几个步骤,由浅入深地介绍设计师通过洞察和理解用户内在需求来指导产品创新和设计的理念。一起来看看 《不止情感设计》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

MD5 加密
MD5 加密

MD5 加密工具