Skip to content

Commit 997c6c5

Browse files
committed
Minor fix in MVC reference doc chapter
Issues: SPR-9111
1 parent caa50a1 commit 997c6c5

File tree

1 file changed

+9
-7
lines changed
  • spring-framework-reference/src

1 file changed

+9
-7
lines changed

spring-framework-reference/src/mvc.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,16 +1575,18 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
15751575
&lt;bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/&gt;</programlisting>
15761576

15771577
<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
15791579
validated using the configured <classname>Validator</classname>
15801580
instance. When using the MVC namespace a JSR-303 validator is
15811581
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>
15881590

15891591
<note>
15901592
<para>Also see <xref linkend="mvc-annotation-driven" /> for

0 commit comments

Comments
 (0)