1.請求參數格式必須是正確的JSON。json
2.在入參中使用註解@RequestBody,用於接收JSON參數,使其自動轉對象後端
3.關於lombok在此產生的一點小坑,@Builder對@RequestBody的影響app
4.標識請求參數的格式爲JSON--->> @PostMapping(value="/Test",produces = "application/json;charset=UTF-8")ui
@RestController @RequestMapping("/Test") public class TestController { @PostMapping(value="/Test",produces = "application/json;charset=UTF-8") public ContentSet Test(@RequestBody CommandInfo commandInfo){ System.out.println(commandInfo); return null; } }
@Getter @Setter @ToString public class CommandInfo implements Serializable { private int XXX; private int ZZZ; private Map<String,String> ,mapPamater;