您的位置:首页 > 移动开发

spring boot 学习笔记(2)--@PathVariable @RequestParam @GetMapping @PostMapping

2017-11-06 11:43 716 查看

1、 - @RestController = @Controller+@ResponseBody

2、 Controller 中url 各个参数使用

@PathVariable —–获取url中的数据

@RequestParam —-获取请求参数的值

@GetMapping,@POSTMapping ——组合注解

@RequestParam用法





@PathVariable用法

(1)





(2)





@GetMapping,@POSTMapping –组合注解



@GetMapping=@RequestMapping(method = RequestMethod.GET)的缩写,是一个组合注解

@PostMapping=@RequestMapping(method = RequestMethod.POST)的缩写,是一个组合注解**

Spring4.3中引进了{@GetMapping、@PostMapping、@PutMapping、@DeleteMapping、@PatchMapping},来帮助简化常用的HTTP方法的映射,并更好地表达被注解方法的语义。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐