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

查看所有标签

猜你喜欢:

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

An Introduction to Genetic Algorithms

An Introduction to Genetic Algorithms

Melanie Mitchell / MIT Press / 1998-2-6 / USD 45.00

Genetic algorithms have been used in science and engineering as adaptive algorithms for solving practical problems and as computational models of natural evolutionary systems. This brief, accessible i......一起来看看 《An Introduction to Genetic Algorithms》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具