Skip to main content

REST Request Validation

Learn REST Request Validation (Validation, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes REST request validation checks a JSON body or parameters: put @Valid on a @RequestBody and constraints on the DTO. Failure throws MethodArgumentNotValidException , which Spring turns into 400 Bad Request by default. Parameters : constraints on @RequestParam and @PathVariable need @Validated on the class.

More lessons in Validation