springboot后台接收参数
参数形式 | 单个参数接收形式 | 多个参数接收形式 |
---|---|---|
/{id} | @PathVariable(“id”)Long id | @PathVariable(“id”)Long id … |
?id | @RequestParam(“id”)Long id | @RequestParam(“id”)Long id … 或者User user |
form | @RequestParam(“id”)Long id | @RequestParam(“id”)Long id …或者User user |
feign远程调用接收参数
feign 远程调用传对象最佳选择JSON,/{id}、?id 参数接收形式不能直接用对象,需要添加@RequestBody注解。
参数形式 | 单个参数接收形式 | 多个参数接收形式 |
---|---|---|
/{id} | @PathVariable(“id”)Long id | @PathVariable(“id”)Long id … |
?id | @RequestParam(“id”)Long id | @RequestParam(“id”)Long id … |
JSON | 。。。 | @RequestBody User user |