Spring @ExceptionHandler does not work with @ResponseBody
Your method @ExceptionHandler(IllegalArgumentException.class) public @ResponseBody Map<String, Object> handleException(final Exception e, final HttpServletRequest request, Writer writer) does not work because it has the wrong return type. @ExceptionHandler methods have only two valid return types: String ModelAndView. See http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html for more information. Here’s the specific text from the link: The return type can be a String, which … Read more