I\'m using Spring3 framework ,hibernate validator and jackson.
when I request for jsondata to server. returned 400 Bad Request error.
then my data is missmatch t
Data binding (mapping request to objects) is an independent process from data validation. In Spring, data binding can contribute with its own binding errors to overall validation errors.
Binding errors are supported by Spring's standard WebDataBinder
, which kicks in when the method parameter is annotated with @ModelAttribute
With @RequestBody
annotation a completely different mechanism is used - HttpMessageConverter
s (in you case probably the MappingJackson2HttpMessageConverter
). When the JSON unmarshalling fails a HttpMessageNotReadableException
exception is thrown.
You can handle exceptions within your global HandlerExceptionResolver
or a special @ExceptionHandler
annotated handler method within the handler itself or a global @ControllerAdvice
.