@@ -1575,16 +1575,18 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
1575
1575
< bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/> </programlisting >
1576
1576
1577
1577
<para >An <classname >@RequestBody</classname > method parameter can be
1578
- annotated with <classname >@Valid</classname >, in which case it will
1578
+ annotated with <classname >@Valid</classname >, in which case it will be
1579
1579
validated using the configured <classname >Validator</classname >
1580
1580
instance. When using the MVC namespace a JSR-303 validator is
1581
1581
configured automatically assuming a JSR-303 implementation is
1582
- available on the classpath. If validation fails a
1583
- <classname >RequestBodyNotValidException</classname > is raised. The
1584
- exception is handled by the
1585
- <classname >DefaultHandlerExceptionResolver</classname > and results in
1586
- a <literal >400</literal > error sent back to the client along with a
1587
- message containing the validation errors.</para >
1582
+ available on the classpath.</para >
1583
+ <para >Unlike <classname >@ModelAttribute</classname > parameters, for which
1584
+ a <classname >BindingResult</classname > can be used to examine the errors,
1585
+ <classname >@RequestBody</classname > validation errors always result in a
1586
+ <classname >MethodArgumentNotValidException</classname > being raised.
1587
+ The exception is handled in the
1588
+ <classname >DefaultHandlerExceptionResolver</classname >, which sends
1589
+ a <literal >400</literal > error back to the client.</para >
1588
1590
1589
1591
<note >
1590
1592
<para >Also see <xref linkend =" mvc-annotation-driven" /> for
0 commit comments