SPR-6709 Handle RequestBodyNotValidException and update reference docs
This commit is contained in:
@@ -1369,9 +1369,18 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
|
||||
<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/>
|
||||
</programlisting>
|
||||
|
||||
<para>An <classname>@RequestBody</classname> method parameter can be annotated with
|
||||
<classname>@Valid</classname>, in which case it will validated using the configured
|
||||
<classname>Validator</classname> 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 <classname>RequestBodyNotValidException</classname>
|
||||
is raised. The exception is handled by the <classname>DefaultHandlerExceptionResolver</classname>
|
||||
and results in a <literal>500</literal> error send back to the client along with
|
||||
a message containing the validation errors.</para>
|
||||
|
||||
<note>
|
||||
<para> Also see <xref linkend="mvc-annotation-driven"/> for information on
|
||||
configuring message converters through the MVC namespace.</para>
|
||||
configuring message converters and a validator through the MVC namespace.</para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user