请问示例项目中用的是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