[fix] @Validated 컨트롤러 파라미터 검증 실패 시 500 에러 반환 버그 수정#360
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesHandlerMethodValidationException 처리 로직 추가
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Results488 tests 488 ✅ 46s ⏱️ Results for commit 4e99e5b. |
#️⃣ 연관된 이슈
📝 작업 내용
문제
Spring Boot 3.x (Spring Framework 6.1+)에서 @validated 컨트롤러의
@PathVariable @pattern 검증 실패 시 HandlerMethodValidationException이 발생하지만
GlobalExceptionHandler에 해당 핸들러가 없어 handleServerErrors(RuntimeException)로
떨어져 500을 반환하던 문제
원인
Spring 6.1+에서 컨트롤러 메서드 파라미터 검증 실패 시
기존 ConstraintViolationException 대신 HandlerMethodValidationException을 던지도록 변경됨
기존 핸들러는 ConstraintViolationException만 처리하고 있었음
--> HandlerMethodValidationException 전용 핸들러 추가 → 400 반환
📸 스크린샷
💬 리뷰 요구사항
📌 PR 진행 시 이러한 점들을 참고해 주세요
Summary by CodeRabbit
버그 수정