Add property to disable Sentinel auto-configuration

pull/1095/head
yuhuangbin 5 years ago
parent e4a4e7f288
commit 1e26df1aa1

@ -24,6 +24,7 @@ import javax.annotation.PostConstruct;
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 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ConditionalOnClass(
name = { "reactor.core.publisher.Mono", "reactor.core.publisher.Flux" })
@ConditionalOnProperty(name = "spring.cloud.circuitbreaker.sentinel.enabled",
havingValue = "true", matchIfMissing = true)
public class ReactiveSentinelCircuitBreakerAutoConfiguration {
@Bean

@ -26,6 +26,7 @@ import com.alibaba.csp.sentinel.SphU;
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.CircuitBreakerFactory;
import org.springframework.cloud.client.circuitbreaker.Customizer;
import org.springframework.context.annotation.Bean;
@ -38,6 +39,8 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnClass({ SphU.class })
@ConditionalOnProperty(name = "spring.cloud.circuitbreaker.sentinel.enabled",
havingValue = "true", matchIfMissing = true)
public class SentinelCircuitBreakerAutoConfiguration {
@Bean

@ -0,0 +1,7 @@
{"properties": [
{
"name": "spring.cloud.circuitbreaker.sentinel.enabled",
"type": "java.lang.Boolean",
"description": "enable sentinel circuitbreaker or not."
}
]}
Loading…
Cancel
Save