If you want to use resilience4j with Spring Cloud Config, add the Spring Cloud2 Starter of Resilience4j to your compile dependency.
repositories {
jCenter()
}
dependencies {
compile "io.github.resilience4j:resilience4j-spring-cloud2:${resilience4jVersion}"
}The configuration is similar to resilience4j-spring-boot2.
Setup and usage in Spring Cloud 2 with Spring Boot 2 is demonstrated in this demo.
There are two modules in demo. server module is spring-cloud-config server. It serves config files inside the config branch. client module is Spring Boot 2 application with spring-cloud-config.
- Start the
servermodule.
- It works as spring-cloud-config server.
- Start the
clientmodule afterservermodule is up.
clientapplication will fetchapplication.ymlfromservermodule.
- Request to
http://localhost:8080/check.
- You can see the Resilience4j's default config value in
application.ymlserved byservermodule.
-
Edit some config values in
configbranch for checking changes is applied to registries. -
Request to
http://localhost:8080/actuator/refreshfor refreshing Registry's config.
- Edited configs will be applied to registries.
- Request to
http://localhost:8080/checkagain.
- You can see the edited config values.