diff --git a/spring-framework-reference/src/mvc.xml b/spring-framework-reference/src/mvc.xml index a43dafbcf53..d4ed37faa30 100644 --- a/spring-framework-reference/src/mvc.xml +++ b/spring-framework-reference/src/mvc.xml @@ -1575,16 +1575,18 @@ public void handle(@RequestBody String body, Writer writer) throws IOException { <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/> An @RequestBody method parameter can be - annotated with @Valid, in which case it will + annotated with @Valid, in which case it will be validated using the configured Validator instance. When using the MVC namespace a JSR-303 validator is configured automatically assuming a JSR-303 implementation is - available on the classpath. If validation fails a - RequestBodyNotValidException is raised. The - exception is handled by the - DefaultHandlerExceptionResolver and results in - a 400 error sent back to the client along with a - message containing the validation errors. + available on the classpath. + Unlike @ModelAttribute parameters, for which + a BindingResult can be used to examine the errors, + @RequestBody validation errors always result in a + MethodArgumentNotValidException being raised. + The exception is handled in the + DefaultHandlerExceptionResolver, which sends + a 400 error back to the client. Also see for