SpringMVC 请求映射注解

@GetMapping: 处理get请求,传统的RequestMapping来编写应该是@RequestMapping(value = “/get/{id}”, method = RequestMethod.GET)

新方法可以简写为:
@GetMapping("/get/{id}")
@PostMapping: 处理post请求,传统的RequestMapping来编写应该是@RequestMapping(value = “/get/{id}”,method = RequestMethod.POST)
新方法可以简写为:
@PostMapping("/get/{id}")
@PutMapping: 和PostMapping作用等同,都是用来向服务器提交信息。如果是添加信息,倾向于用@PostMapping,如果是更新信息,倾向于用@PutMapping。两者差别不是很明显。

@DeleteMapping 删除URL映射,具体没有再实践中用过,不知道好在什么地方

@PatchMapping 个人觉得应该是修改映射,我很少用

原文地址:https://www.cnblogs.com/nongzihong/p/12034865.html