@PathVariable

作用:可以通过url占位符中的参数,绑定到处理器方法的参数中

@GetMapping("/{id}")
    public Shop getShop(@PathVariable("id") int id){
       Shop shop = shopService.findShop(id);
       return shop;
    }
原文地址:https://www.cnblogs.com/mm163/p/10831141.html