I'm using Spring 3.0.2 to try out the @Controller stuff for a JSON based REST API. Everything is going well, except when it comes to exception management during binding.

I have a method which accepts JSON data:

Code:
@RequestMapping(value="/register", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
void register(@RequestBody Registration registration);
This works perfectly when the JSON received can actually be bound to the Registration object. However, when the payload contains type-mismatched data which can't even be bound (like setting a boolean value to an integer field), the server spews out a less than helpful 500 error with some useless Jackson mapping exception:

Code:
org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of int out of VALUE_FALSE token
 at [Source: org.apache.catalina.connector.CoyoteInputStream@25e7bff8; line: 1, column: 113]
	org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:159)
	org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:192)
	org.codehaus.jackson.map.deser.StdDeserializer._parseInt(StdDeserializer.java:151)
	org.codehaus.jackson.map.deser.StdDeserializer$IntegerDeserializer.deserialize(StdDeserializer.java:545)
	org.codehaus.jackson.map.deser.StdDeserializer$IntegerDeserializer.deserialize(StdDeserializer.java:533)
	org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:135)
	org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:221)
	org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:390)
	org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:286)
	org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:1588)
	org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1158)
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:111)
	org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:152)
	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestBody(HandlerMethodInvoker.java:552)
	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:283)
	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:163)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)

  ...
I've debugged the Spring code, and the exception being thrown (JsonMappingException) doesn't contain any sort of path information to the property which failed to bind.

How can I trap more granular and useful exception information in this case so I can respond appropriately? I'd like to treat these exceptions just like I do my ConstraintViolations: return a JSON map which has a list of field-level errors along with the exceptions associated with each field. Given what I seem to have, I am not sure how I'm going to get to the property path I need...

How are other people handling this? I don't see any meaningful way to respond to the client.