'Spring cloud Netflix-Hystrix gradle dependency not allowing spring boot application to start
I have built simple microservice application using Spring-Boot and Eureka server. Now, I want to add fault-tolerance in case any of service registered in Eureka server is down. So, I used netflix-hystrix gradle dependency. But that dependency caused my application to crash.
I am getting following error message when running application:
Execution failed for task ':compileJava'. Could not resolve all files for configuration ':compileClasspath'. Could not find org.springframework.cloud:spring-cloud-starter-netflix-hystrix:.
For reference I have added snippet of build.gradle file.
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}"
}
}
Solution 1:[1]
I believe you should also specify the version of the dependency:
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.7.RELEASE'
Solution 2:[2]
I had the same issue and found this official link where they say:
As announced, the following modules have been removed from spring-cloud-netflix:
- ...
- spring-cloud-netflix-hystrix
- spring-cloud-starter-netflix-hystrix
- ... (some other spring-cloud-netflix-* subprojects)
So it appears that Hystrix dependency will no longer be managed by spring-cloud-release. That's why you have to manually specify version. Anyway it doesn't mean that Spring Hystrix is/will be deprecated but i don't know that part yet...
I'm answering this question now because i found it after digging a lot and don't want anyone has to do it again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cosmin Ioni?? |
Solution 2 | PedroRodP |