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

查看所有标签

猜你喜欢:

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

Agile Web Application Development with Yii 1.1 and PHP5

Agile Web Application Development with Yii 1.1 and PHP5

Jeffrey Winesett / Packt Publishing / 2010-08-27

In order to understand the framework in the context of a real-world application, we need to build something that will more closely resemble the types of applications web developers actually have to bu......一起来看看 《Agile Web Application Development with Yii 1.1 and PHP5》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具