Controller内的三个注释解析@RequestMapping、@PostMapping、@GetMapping

Controller内的三个注释解析@RequestMapping、@PostMapping、@GetMapping

202109072210214

@RequestMapping包含其他返回类型,Post,Get,PATCH,PUT等都可以响应,一般情况下使用@RequestMapping注释即可

@PostMapping响应类型就是Post,相当于@RequestMapping(value = "/hello",method = RequestMethod.Post)

@GetMapping响应类型就是Get,相当于@RequestMapping(value = "/hello",method = RequestMethod.Get)

posted @ 2021-11-08 19:25  HeiDaotu  阅读(189)  评论(0编辑  收藏  举报