[TIL-Annotation]@RequestBody(mapping)

이용준·2023년 5월 24일
0

TIL

목록 보기
16/21
post-thumbnail
  • HTTP의 Body 내용을 해당 어노테이션이 지정된 객체에 매핑하는 역할
@PostMapping("/member")
public String postMember(@RequestBody Map<String, Object> postData){
	StringBuilder sb = new StringBuilder();

	postData.entrySet().forEach(map->{
		sb.append(map.getKey()+":"+map.getValue()+"\n");
	});

	return sb.toString();
}
- Map 객체는 요청값을 특정하기 어려울 경우 주로 사용

참고

profile
뚝딱뚝딱

0개의 댓글