ExceptionHandler returning JSON or XML not working in spring mvc 3
问题 code is like this: @Controller public class TestController { @RequestMapping(value = "/testerror", method = RequestMethod.GET) public @ResponseBody ErrorTO testerror(HttpServletRequest request,HttpServletResponse response) { throw new ABCException("serious error!"); } @ExceptionHandler(ABCException.class) public @ResponseBody ErrorTO handleException(ABCException ex, HttpServletRequest request, HttpServletResponse response) { response.setStatus(response.SC_BAD_REQUEST); return new ErrorTO(ex