Resilience4j version: resilience4j-cloud2-1.4.0-release
Java version: 1.8
Problem description:
after adding compile "io.github.resilience4j:resilience4j-spring-cloud2:1.4.0-SNAPSHOT" in gradle project, there is a compile error in CircuitBreakerConfiguration.java.

I just follow the instruction in spring-cloud / Getting Started.
it is the output when spring boot application started.
APPLICATION FAILED TO START
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
io.github.resilience4j.circuitbreaker.configure.CircuitBreakerConfiguration.createCircuitBreakerRegistry(CircuitBreakerConfiguration.java:141)
The following method did not exist:
io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry.of(Ljava/util/Map;Lio/github/resilience4j/core/registry/RegistryEventConsumer;Lio/vavr/collection/Map;)Lio/github/resilience4j/circuitbreaker/CircuitBreakerRegistry;
The method's class, io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry, is available from the following locations:
jar:file:/Users/Tsing/.gradle/caches/modules-2/files-2.1/io.github.resilience4j/resilience4j-circuitbreaker/1.1.0/d80782b928298b4c0c174af3fe659a4c01ba7533/resilience4j-circuitbreaker-1.1.0.jar!/io/github/resilience4j/circuitbreaker/CircuitBreakerRegistry.class
It was loaded from the following location:
file:/Users/Tsing/.gradle/caches/modules-2/files-2.1/io.github.resilience4j/resilience4j-circuitbreaker/1.1.0/d80782b928298b4c0c174af3fe659a4c01ba7533/resilience4j-circuitbreaker-1.1.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry
gradle file:
ext {
set('springCloudVersion', "Hoxton.RELEASE")
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
compile 'io.micrometer:micrometer-registry-prometheus:latest.release'
implementation 'io.github.resilience4j:resilience4j-micrometer'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compile "io.github.resilience4j:resilience4j-spring-cloud2:1.4.0-SNAPSHOT"
compile('org.springframework.cloud:spring-cloud-starter-zookeeper-config') {
exclude group: 'org.apache.zookeeper', module: 'zookeeper'
}
compile('org.apache.zookeeper:zookeeper:3.4.12') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
Yes, spring cloud dependencies brings in old versions of Resilience4j because of Spring Cloud CircuitBreaker. You should exclude them or override them.
which module should I exclude?
The Resilience4j dependencies coming from the spring-cloud-dependencies pom.
See https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/#dependency-management-configuration-dsl-exclusions
thanks!
can you please send the correct build.gradle file; what dependencied to exclude, i couldnot figureout.
You can override it like this to fix this issue if you can't figure what dependency is including the older version of resiliency4j. resilience4j-spring-boot2 would include the other dependencies but we still need to override it here to circumvent the issue.
<!--Spring resilience4j dependency-->
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-circuitbreaker</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-timelimiter</artifactId>
<version>1.3.1</version>
</dependency>
Most helpful comment
You can override it like this to fix this issue if you can't figure what dependency is including the older version of resiliency4j.
resilience4j-spring-boot2would include the other dependencies but we still need to override it here to circumvent the issue.