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

http://localhost:8080/emp/1

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

通过PathVariable注解,如下:

@DeleteMapping("/emp/{id}")
    public String deleteEmp(@PathVariable("id") Integer id){
  
}
原文地址:https://www.cnblogs.com/bear7/p/13492398.html