• xu_xuanjie
    2020-01-04
    老师,每个模块讲到最后都有介绍Spring Cloud系列的,我有个疑问就是听了老师的课,比如理解了Hystrix后,是不是直接可以使用Spring Cloud系列,毕竟在代码上看来是优雅很多。当然,像Spring Cloud Config和Apollo这种显著的区别当然不能对比;主要是对Spring Cloud Hystrix,Spring Cloud Zuul这些只是在Hystrix和Zuul的基础上方便于使用而集成的,应该如何选择?

    作者回复: 尽量使用Spring Cloud套餐,经过包装开发体验较好,能够省很多事情。

    
    
  • Geek_382ccc
    2019-08-29
    请问示例项目中用的是1.5.X版本的spring boot,为什么不用2.X版本的呢?
    我在本地新建了spring boot2.1.6版本的项目,引入gateway和hystrix依赖,使用yml配置路由规则和降级设置,可以正常启动并运行访问; 但是当引入dashboard后,启动时就会报错,解决了spring-boot-starter-web包的冲突后,依然报错
    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.example.springcloudgatewayexample.SpringCloudGatewayExampleApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration
    无法正常启动;网上搜不到解决方案。老师知道是什么原因吗?
    展开

    作者回复: 你好,课程开发时候spring boot正式release版本是1.5.x,所以就用该版本做演示。

    spring boot升级变动比较频繁,难免碰到不兼容的坑,spring cloud netflix明确支持hystrix + dashboard的,可以参考其官方文档:
    https://spring.io/projects/spring-cloud-netflix,
    从你的错误看,像是有不兼容问题,建议换spring boot版本再试。

    这里有spring cloud 2搭建hystrix/dashboard案例,可以参考:
    https://www.cnblogs.com/jonban/p/hystrix-dashboard.html

     1
    
我们在线,来聊聊吧