组合注解(RequestMapping的变形)
- @GetMapping = @RequestMapping(method = RequestMethod.GET)
- @PostMapping = @RequestMapping(method = RequestMethod.POST)
- @PutMapping = @RequestMapping(method = RequestMethod.PUT)
- @DeleteMapping = @RequestMapping(method = RequestMethod.DELETE
1、原始springMVC的请求
如图:
2、使用SpringBoot的请求
@RestController
//案例在caseController 里面添加
public class caseController {
}
- 通过@PathVariable接收参数
/** * 通过@PathVariable接收参数 */ @GetMapping(value="/test1/{id}/{name}") public Map<String, Object> getMap(@PathVariable("id") String id, @PathVariable("name") String name) { Map<String,Object> map =