Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 如何在filterRegistrationBean中使用URL模式_Spring Boot_Url_Filter_Pattern Matching - Fatal编程技术网

Spring boot 如何在filterRegistrationBean中使用URL模式

Spring boot 如何在filterRegistrationBean中使用URL模式,spring-boot,url,filter,pattern-matching,Spring Boot,Url,Filter,Pattern Matching,我无法在过滤器注册中概括所需的URL模式,因为我的URL是 http://localhost:8080/service/v1/dsply http://localhost:8080/service/v1/smry/smry1 http://localhost:8080/service/v1/smry/smry2 其中我的根上下文是service/v1。我想包括v1之后的所有内容。 是否可以在addUrlPatterns中包含根上下文 我已经尝试过像/v1/**,/v1/*,/v1/*/这样的

我无法在过滤器注册中概括所需的URL模式,因为我的URL是

  • http://localhost:8080/service/v1/dsply
  • http://localhost:8080/service/v1/smry/smry1
  • http://localhost:8080/service/v1/smry/smry2
其中我的根上下文是
service/v1
。我想包括
v1
之后的所有内容。 是否可以在addUrlPatterns中包含根上下文

我已经尝试过像
/v1/**
/v1/*
/v1/*/
这样的模式,但似乎都不起作用。但是如果我使用像
/dsply
/smry/*
这样的端点,它就工作了

@Bean
public FilterRegistrationBean fltrRgst(){
    FilterRegistrationBean rgst = new FilterRegistrationBean();
    rgst.setFilter(new myFilter());
    rgst.setOrder(1);
    rgst.addUrlPatterns("/v1/*","/v1/*/")
}

您的根上下文是什么?请尝试设置
**/v1/**