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

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

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

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》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

Go程序设计语言

Go程序设计语言

艾伦 A. A. 多诺万 / 李道兵、高博、庞向才、金鑫鑫、林齐斌 / 机械工业出版社 / 2017-5 / 79

本书由《C程序设计语言》的作者Kernighan和谷歌公司Go团队主管Alan Donovan联袂撰写,是学习Go语言程序设计的指南。本书共13章,主要内容包括:Go的基础知识、基本结构、基本数据类型、复合数据类型、函数、方法、接口、goroutine、通道、共享变量的并发性、包、go工具、测试、反射等。 本书适合作为计算机相关专业的教材,也可供Go语言爱好者阅读。一起来看看 《Go程序设计语言》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具