SpringMVC中请求路径参数使用正则表达式 1 @GetMapping("/user/{id:\d+}") //使用正则指定Id为数字 2 public User getInfo(@PathVariable String id){ 3 ... 4 }