Spring4.3中引進了{@GetMapping、@PostMapping、@PutMapping、@DeleteMapping、@PatchMapping},來幫助簡化常用的HTTP方法的映射,並更好地表達被注解方法的語義。
以@GetMapping為例,Spring官方文檔說:
@GetMapping是一個組合注解,是@RequestMapping(method = RequestMethod.GET)的縮寫。該注解將HTTP Get 映射到 特定的處理方法上。
Difference between @GetMapping & @RequestMapping:
@GetMapping does not support the consumes attribute of @RequestMapping.
原文鏈接:https://blog.csdn.net/webzhuce/article/details/53319468
