SpringBoot获取url参数的方式
方式一
@RequestMapping(value = "/select",method = RequestMethod.GET)
public void selectUserById(@RequestParam("id") Integer id){
System.out.println(id);
}
//http://localhost:8080/select?id=1
方式二
@RequestMapping(value = "/select/{id}",method = RequestMethod.GET)
public void selectUserById(@PathVariable("id") Integer id){
System.out.println(id);
}
//http://localhost:8080/select/1