1.咱們使用Postman軟件工具向spring-boot發送post形式的數據,以下:java
2.再來看一下咱們的實體類的代碼:spring
RespCode.javaspringboot
package com.springboot.cib_hk.bean; import lombok.Data; /** * @author zhuhonggen * @version 建立時間:2019/08/10 14:01 * @ClassName 類名稱 * @Description 類描述 */ @Data public class RespCode { private Integer code; private String meg; private Object data; public RespCode(Integer code, String meg, Object data) { this.code = code; this.meg = meg; this.data = data; } }
3.再來看下咱們的controler代碼如何編寫的:app
@PostMapping(value = {"/getresp"}) public RespCode getresp(@RequestBody Users users){ Object data = users; return new RespCode(200,"henhao",data); }