SpringBoot增删改查对应的注解

Spring4.3中引进了@GetMapping、@PostMapping、@PutMapping、@DeleteMapping 来帮助简化常用的HTTP方法的映射 并更好地表达被注解方法的语义
对于刚刚接触springboot的新手会分不清什么时候用哪一个,接下来我就介绍一下这几个注解的主要形式和作用

1、@GetMapping
@RequestMapping(method = RequestMethod.GET)的简写
作用:对应查询,表明是一个查询URL映射

2、@PostMapping
@RequestMapping(method = RequestMethod.POST)的简写
作用:对应增加,表明是一个增加URL映射

3、@PutMapping
@RequestMapping(method = RequestMethod.PUT)的简写
作用:对应更新,表明是一个更新URL映射

4、@DeleteMapping
@RequestMapping(method = RequestMethod.DELETE)的简写
作用:对应删除,表明是一个删除URL映射

你可能感兴趣的:(SpringBoot学习笔记)