Spring controller enum request validation
<p>I have a simple spring rest controller that looks like this.</p>

<pre><code>@RestController
public class MyController {

@RequestMapping(path = "mapping", method = RequestMethod.POST, produces = {"application/json"})
    public MyResponse create(@RequestBody MyModel requestParam
    ) throws InvalidApplicationSentException, AuthenticationFailedException {
 // method body
}
</code></pre>

<p>Here is the MyModel class that's used as a request parameter.</p>

<pre><code>public class MyModel {
    private RequestType requestType;
    // a lot of other properties ..
}
</code></pre>

<p>Now when i try to call this endpoint passing an invalid value for RequestType I get back an exeption:</p>

<pre><code>org.springframework.http.converter.HttpMessageNotReadableException
Could not read document: Can not construct instance of com.mypackage.RequestType from String value 'UNDEFINED': value not one of declared Enum instance names: [IMPROTANT, NOT_IMPORTANT]
</code></pre>

<p>Is there a way that spring would set the enum to null when passed incorrect value and not throw an error?</p>

<p>I'm using spring 4 and I would prefer configuration with annotations and not xml files</p>