我想将所有请求与不以'api'开头的PathVariable匹配。我测试下面的RequestMapping。 spring可以匹配请求,但无法为PathVariable获取价值。我如何解决这个问题?Spring-MVC PathVariable匹配不以word开头的正则表达式
@RequestMapping(value = "/{name:(?!api).+}", method = RequestMethod.GET)
public void getNotApi(@PathVariable String name, HttpServletResponse response) {
...
}
我获得以下像localhost:8080/resource
一些请求消息。
Error 500 Missing URI template variable 'name' for method parameter of type String