1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00
This commit is contained in:
fangjian0423 2019-07-30 12:33:13 +08:00
parent 7a9b8a73e8
commit 368487931f
3 changed files with 17 additions and 1 deletions

View File

@ -9,6 +9,7 @@ management.health.diskspace.enabled=false
spring.cloud.sentinel.transport.dashboard=localhost:8080 spring.cloud.sentinel.transport.dashboard=localhost:8080
spring.cloud.sentinel.eager=true spring.cloud.sentinel.eager=true
#spring.cloud.sentinel.http-method-specify=false
spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json
spring.cloud.sentinel.datasource.ds1.file.data-type=json spring.cloud.sentinel.datasource.ds1.file.data-type=json

View File

@ -89,6 +89,11 @@ public class SentinelProperties {
*/ */
private Log log = new Log(); private Log log = new Log();
/**
* Add HTTP method prefix for Sentinel Resource.
*/
private Boolean httpMethodSpecify = false;
public boolean isEager() { public boolean isEager() {
return eager; return eager;
} }
@ -161,7 +166,15 @@ public class SentinelProperties {
this.log = log; this.log = log;
} }
public static class Flow { public Boolean getHttpMethodSpecify() {
return httpMethodSpecify;
}
public void setHttpMethodSpecify(Boolean httpMethodSpecify) {
this.httpMethodSpecify = httpMethodSpecify;
}
public static class Flow {
/** /**
* The cold factor {@link SentinelConfig#COLD_FACTOR}. * The cold factor {@link SentinelConfig#COLD_FACTOR}.

View File

@ -91,6 +91,8 @@ public class SentinelWebAutoConfiguration {
Filter filter = new CommonFilter(); Filter filter = new CommonFilter();
registration.setFilter(filter); registration.setFilter(filter);
registration.setOrder(filterConfig.getOrder()); registration.setOrder(filterConfig.getOrder());
registration.addInitParameter("HTTP_METHOD_SPECIFY",
String.valueOf(properties.getHttpMethodSpecify()));
log.info( log.info(
"[Sentinel Starter] register Sentinel CommonFilter with urlPatterns: {}.", "[Sentinel Starter] register Sentinel CommonFilter with urlPatterns: {}.",
filterConfig.getUrlPatterns()); filterConfig.getUrlPatterns());