Development/Spring
@RequestBody
codedragon
2020. 2. 15. 10:02
반응형
@RequestBody
· HTTP POST 요청에 대해서만 처리합니다.
· HTTP POST 요청에 대해 request body에 있는 request message에서 값을 얻어와 매칭합니다.
· RequestData를 바로 Model이나 클래스로 매핑합니다. 이를테면 JSON 이나 XML같은 데이터를 적절한 messageConverter로 읽을 때 사용하거나 POJO 형태의 데이터 전체로 받는 경우에 사용합니다.
· HTTP Request Body(요청 몸체)를 Java Object로 전달 받을 수 있습니다.
@PostMapping("/bbs/{index}") @ResponseBody public boolean deletePost(@PathVariable("index") int articleId) { //... return true; } |