목록2020/10/11 (1)
훈훈훈
Spring :: @RequestBody with Multiple Object arguments 오류 정리
- 문제 발생한 코드 > 예제코드는 Kotlin으로 작성되었습니다. @PostMapping("/testController") fun testController( @RequestBody testDTO1: TestDTO1, @RequestBody testDTO2: TestDTO2 ): ResponseEntity { return ResponseEntity(HttpStatus.OK) } PostMapping 할 때 두개 이상 @RequestBody를 받는 경우 JSON parse error 발생 - 원인 request 할 때 Input Stream 은 한번만 실행이 된다. 따라서 두번째 인자를 받을땐 Input Stream 이 close 상태이기 때문에 에러가 발생 즉, RequestBody annotation..
Spring Framework/개념
2020. 10. 11. 01:40