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:
parent
e2024a441d
commit
effff23108
@ -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);
|
||||
}
|
||||
}
|
@ -2,3 +2,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.alibaba.cloud.sentinel.gateway.zuul.SentinelZuulAutoConfiguration,\
|
||||
com.alibaba.cloud.sentinel.gateway.scg.SentinelSCGAutoConfiguration,\
|
||||
com.alibaba.cloud.sentinel.gateway.SentinelGatewayAutoConfiguration
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=com.alibaba.cloud.sentinel.gateway.GatewayEnvironmentPostProcessor
|
Loading…
x
Reference in New Issue
Block a user