← Quiz: Validation and Errors: all 10 questions
Quiz: Validation and Errors · Question 7 of 10
Which exception does Spring throw when a @Valid @RequestBody DTO fails its constraints?
Which exception does Spring throw when a @Valid @RequestBody DTO fails its constraints?
- A.MethodArgumentNotValidException
- B.CourseNotFoundException
- C.NullPointerException
- D.IllegalStateException
Answer & explanation
Correct answer: MethodArgumentNotValidException
The advice class handles it and turns it into a 400 ProblemDetail with field errors.
Can you get the rest right without peeking?
Take the timed Quiz: Validation and Errors quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →