
[Spring] ResponseEntity의 유용한 메소드들 [200 OK, 400 Bad Request, 404 Not Found, 201 Created 등]
·
▣ Framework/Spring🍃
- ResponseEntity의 유용한 메소드들1. ResponseEntity.ok(): 200 OK 응답 반환return ResponseEntity.ok("성공");2. ResponseEntity.badRequest(): 400 Bad Request 응답 반환return ResponseEntity.badRequest().body("잘못된 요청입니다.");3. ResponseEntity.notFound(): 404 Not Found 응답 반환return ResponseEntity.notFound().build();4. ResponseEntity.created(): 201 Created 응답 반환 (새로운 리소스 생성 시)URI location = URI.create("/resource/1");return..