huifer/javaBook-src

RequestMapping

huifer opened this issue · 0 comments

  • 细节正则表达式
@RestController
@RequestMapping("/demo")
public class DemoController {
    @GetMapping("/{id:\\d+}")
    public String obj(
            @PathVariable("id") String id
    ) {
        return id;
    }
}

通过:正则来进行url参数过滤,或者说url不存在