code is like this:
@Controller
public class TestController {
@RequestMapping(value = \"/testerror\", method = RequestMethod.GET)
pub
Seems like a known Spring bug (Fixed in 3.1 M1)
https://jira.springsource.org/browse/SPR-6902
It appears that AnnotationMethodHandlerExceptionResolver has its own array of HttpMessageConverters. You need to configure it to use the same array as used by AnnotationMethodHandlerAdapter.
However, it can be complicated when AnnotationMethodHandlerAdapter is declared implicitly. Perhaps declaring the following FactoryBean may help in all cases:
public class AnnotationMethodHandlerExceptionResolverFactoryBean
implements FactoryBean<AnnotationMethodHandlerExceptionResolver> {
@Autowired
private AnnotationMethodHandlerAdapter a;
public AnnotationMethodHandlerExceptionResolver getObject()
throws Exception {
AnnotationMethodHandlerExceptionResolver r = new AnnotationMethodHandlerExceptionResolver();
r.setMessageConverters(a.getMessageConverters());
return r;
}
...
}