Skip to content
Permalink
Browse files

Add property to disable resilience4j configuration.

  • Loading branch information
ryanjbaxter committed Oct 31, 2019
1 parent e411101 commit aacf4d35183de568e560f0b9d6e5b54fdd680ecc
@@ -7,6 +7,10 @@ There are two starters for the Resilience4J implementations, one for reactive ap
* `org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j` - non-reactive applications
* `org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j` - reactive applications

==== Auto-Configuration
You can disable the Resilience4J auto-configuration by setting
`spring.cloud.circuitbreaker.resilience4j.enabled` to `false`.

==== Default Configuration

To provide a default configuration for all of your circuit breakers create a `Customize` bean that is passed a
@@ -24,6 +24,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.circuitbreaker.Customizer;
import org.springframework.cloud.client.circuitbreaker.ReactiveCircuitBreakerFactory;
import org.springframework.context.annotation.Bean;
@@ -35,6 +36,8 @@
@Configuration
@ConditionalOnClass(name = { "reactor.core.publisher.Mono", "reactor.core.publisher.Flux",
"io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerOperator" })
@ConditionalOnProperty(name = "spring.cloud.circuitbreaker.resilience4j.enabled",
matchIfMissing = true)
public class ReactiveResilience4JAutoConfiguration {

@Bean
@@ -23,6 +23,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
import org.springframework.cloud.client.circuitbreaker.Customizer;
import org.springframework.context.annotation.Bean;
@@ -32,6 +33,8 @@
* @author Ryan Baxter
*/
@Configuration
@ConditionalOnProperty(name = "spring.cloud.circuitbreaker.resilience4j.enabled",
matchIfMissing = true)
public class Resilience4JAutoConfiguration {

@Bean
@@ -0,0 +1,10 @@
{
"properties": [
{
"defaultValue": "true",
"name": "spring.cloud.circuitbreaker.resilience4j.enabled",
"description": "Enables Resilience4J auto-configuration.",
"type": "java.lang.Boolean"
}
]
}

0 comments on commit aacf4d3

Please sign in to comment.
You can’t perform that action at this time.