mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sentinel zuul refactor sync in 1.x
This commit is contained in:
parent
c470f56492
commit
af574779fd
@ -45,13 +45,13 @@ import com.netflix.zuul.ZuulFilter;
|
|||||||
* @author tiger
|
* @author tiger
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix = PREFIX, name = "enabled", havingValue = "true")
|
@ConditionalOnProperty(prefix = PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||||
public class SentinelZuulAutoConfiguration {
|
public class SentinelZuulAutoConfiguration {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
|
|
||||||
public static final String PREFIX = "spring.cloud.alibaba.sentinel.zuul";
|
public static final String PREFIX = "spring.cloud.sentinel.zuul";
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SentinelZuulProperties sentinelZuulProperties() {
|
public SentinelZuulProperties sentinelZuulProperties() {
|
||||||
|
@ -310,6 +310,12 @@ public class SentinelProperties {
|
|||||||
*/
|
*/
|
||||||
private List<String> urlPatterns;
|
private List<String> urlPatterns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable to instance
|
||||||
|
* {@link com.alibaba.csp.sentinel.adapter.servlet.CommonFilter}.
|
||||||
|
*/
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return this.order;
|
return this.order;
|
||||||
}
|
}
|
||||||
@ -325,7 +331,15 @@ public class SentinelProperties {
|
|||||||
public void setUrlPatterns(List<String> urlPatterns) {
|
public void setUrlPatterns(List<String> urlPatterns) {
|
||||||
this.urlPatterns = urlPatterns;
|
this.urlPatterns = urlPatterns;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Log {
|
public static class Log {
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ public class SentinelWebAutoConfiguration {
|
|||||||
private SentinelProperties properties;
|
private SentinelProperties properties;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FilterRegistrationBean servletRequestListener() {
|
@ConditionalOnProperty(name = "spring.cloud.sentinel.filter.enabled", matchIfMissing = true)
|
||||||
|
public FilterRegistrationBean sentinelFilter() {
|
||||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||||
|
|
||||||
SentinelProperties.Filter filterConfig = properties.getFilter();
|
SentinelProperties.Filter filterConfig = properties.getFilter();
|
||||||
|
@ -39,6 +39,12 @@
|
|||||||
"defaultValue": "Integer.MIN_VALUE",
|
"defaultValue": "Integer.MIN_VALUE",
|
||||||
"description": "sentinel filter chain order, will be set to FilterRegistrationBean."
|
"description": "sentinel filter chain order, will be set to FilterRegistrationBean."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spring.cloud.sentinel.filter.enabled",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"defaultValue": true,
|
||||||
|
"description": "Enable to instance com.alibaba.csp.sentinel.adapter.servlet.CommonFilter."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spring.cloud.sentinel.metric.charset",
|
"name": "spring.cloud.sentinel.metric.charset",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user