面试官:你知道什么时候用PostMapping和GetMapping吗?
杨同学:如果传的参数是@RequestBody ,多参或者传对象的情况下使用@PostMapping注解
@PostMapping("/getOrderList")
public List<Object> getList(@RequestBody List<Object> orderList) {}
1
2
无参,@RequestParam 和@PathVaiable的情况下使用GetMapping
@gettMapping("/test")
public ModelAndView test16(@RequestParam("id")Long id){}
1
2
@gettMapping("/test/{id}")
public ModelAndView (@PathVaiable("name") Long id){}
1
2
面试官:好的,我们下一个问题