diff --git a/springboot-web-req-resp/src/main/java/com/inmind/controller/RequestController.java b/springboot-web-req-resp/src/main/java/com/inmind/controller/RequestController.java index abef1b8..3721e5f 100644 --- a/springboot-web-req-resp/src/main/java/com/inmind/controller/RequestController.java +++ b/springboot-web-req-resp/src/main/java/com/inmind/controller/RequestController.java @@ -3,6 +3,7 @@ package com.inmind.controller; import com.inmind.pojo.User; import jakarta.servlet.http.HttpServletRequest; import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -66,4 +67,12 @@ public class RequestController { return "OK"; } + //日期参数 + @RequestMapping( "/jsonParam") + //@RequestBody: 将请求体中的json数据,映射为java对象 + public String jsonParam(@RequestBody User user){ + System.out.println(user); + return "OK"; + } + }