1. 程式人生 > >SpringMVC之組合註解

SpringMVC之組合註解

method get ppi patch ring attribute 幫助 chm 特定

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.

SpringMVC之組合註解