1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Disable sentinel web filters.

This commit is contained in:
zhh 2019-08-17 13:48:49 +08:00
parent e2024a441d
commit effff23108
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,24 @@
package com.alibaba.cloud.sentinel.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertiesPropertySource;
import java.util.Properties;
/**
* Created by zhh on 2019/8/17.
*/
public class GatewayEnvironmentPostProcessor implements EnvironmentPostProcessor {
private final static String SENTINEL_FILTER_ENABLED = "spring.cloud.sentinel.filter.enabled";
private final static String FILTERS_DISABLED = "filters_disabled";
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication springApplication) {
Properties properties = new Properties();
properties.setProperty(SENTINEL_FILTER_ENABLED, "false");
PropertiesPropertySource propertySource = new PropertiesPropertySource(FILTERS_DISABLED, properties);
environment.getPropertySources().addLast(propertySource);
}
}

View File

@ -1,4 +1,5 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.sentinel.gateway.zuul.SentinelZuulAutoConfiguration,\ com.alibaba.cloud.sentinel.gateway.zuul.SentinelZuulAutoConfiguration,\
com.alibaba.cloud.sentinel.gateway.scg.SentinelSCGAutoConfiguration,\ com.alibaba.cloud.sentinel.gateway.scg.SentinelSCGAutoConfiguration,\
com.alibaba.cloud.sentinel.gateway.SentinelGatewayAutoConfiguration com.alibaba.cloud.sentinel.gateway.SentinelGatewayAutoConfiguration
org.springframework.boot.env.EnvironmentPostProcessor=com.alibaba.cloud.sentinel.gateway.GatewayEnvironmentPostProcessor