注解:RequestBody PathVariable RequestParam的区别
A: GET http://localhost/getproduct/32
B: GET/POST http://localhost/getproduct?id=32
C: POST http://localhost/getproduct
[POST数据部分内容为: {id:32}
A:@RequestMapping("/getproduct/{id}")
public Product getProduct(@PathVariable("id") Long id){
...
}
B:@RequestMapping("/getproduct")
public Product getProduct(@RequestParam("id") Long id){
...
}
C:@RequestMapping("/getproduct")
public Product getProduct(@RequestBody Product product){
...//Product包含有一个 名字为 id的属性
}
只是为了更好的团圆...