springboot的restful风格获取请求中携带的参数

http://localhost:8080/emp/1

有以上请求,我们controller要怎么获取请求中传递的参数1呢?

通过PathVariable注解,如下:

@DeleteMapping("/emp/{id}")
    public String deleteEmp(@PathVariable("id") Integer id){
  
}

 

posted @ 2020-08-12 18:51  白熊啊  阅读(1227)  评论(0编辑  收藏  举报