标签:数据 ping info span str turn map bsp ons
1.创建基于get参数的rest服务
@RestController @RequestMapping("/action") public class GetController { @GetMapping(value = "/get/{id}",produces = "application/json") public Order getAllOrdersByGet(@PathVariable int id) { Order order = new Order(); order.setOrderId(id); order.setOrderName(String.format("order:%d", id)); return order; } }
2.创建向服务器post数据的rest服务
@RestController
@RequestMapping("/action")
public class PostController {
@PostMapping(value = "/save", consumes = "application/json",produces = "application/json")
public Order getAllOrdersByPost(@RequestBody Order order) {
order.setOrderName("orderFromServer");
return order;
}
}
标签:数据 ping info span str turn map bsp ons
原文地址:https://www.cnblogs.com/Brake/p/11854030.html