java - Spring cloud Netflix-Hystrix gradle 依赖项不允许 Spring Boot 应用程序启动
问题描述
我使用Spring-Boot和Eureka server r 构建了简单的微服务应用程序。现在,我想添加容错,以防在 Eureka 服务器中注册的任何服务出现故障。所以,我使用了 netflix-hystrix gradle dependency。但是这种依赖导致我的应用程序崩溃。
运行应用程序时收到以下错误消息:
Execution failed for task ':compileJava'. Could not resolve all files for configuration ':compileClasspath'. Could not find org.springframework.cloud:spring-cloud-starter-netflix-hystrix:.
作为参考,我添加了build.gradle文件的片段。
plugins {
id 'org.springframework.boot' version '2.4.4'
}
ext {
set('springCloudVersion', "2020.0.2")
}
dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
解决方案
我相信您还应该指定依赖项的版本:
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.7.RELEASE'
推荐阅读
- azure - 通过内部项目实施资源(虚拟机/存储)的使用限制
- python - 基于单个键过滤所有字典键值?
- javascript - 是否可以在 selenium 中禁用某些 javascript 脚本?
- angular7 - 在 ServiceStack 5.8.1 上启用 API 响应压缩 (gzip)
- reporting-services - 如何在 SSMS 中实现空白参数?
- python - 如何附加键值字典python onvif相机
- javascript - 如何将缩小的 div 放置在父 div 的中心内
- jquery - 使侧边栏 div 可滚动
- python - Kaggle:如何从工作目录下载所有文件
- reporting-services - 在 SSRS 中的页面上获取第一条记录