@PathVariable

@PathVariable是spring3.0的一个新功能:接收请求路径中占位符的值

    @PutMapping(value = "/users/{userId}/unLock")
    void unLock(@PathVariable("userId") String id, @RequestBody UnblockEvent unblockEvent) throws Exception {
        userService.apply(unblockEvent);
    }

id就是路径的userId值

posted @ 2020-10-21 13:28  24601  阅读(95)  评论(0编辑  收藏  举报