Spring boot 如何在filterRegistrationBean中使用URL模式
我无法在过滤器注册中概括所需的URL模式,因为我的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/*/这样的
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/**