I am developing a REST service using SpringMVC, where I have @RequestMapping at class and method level.
This application is currently configured to return error-page js
you can return json in the location below,that /handle/404.
404
/handle/404
after you config this in web.xml,a 404 error will redirect to /handle/404,and you can create a controller with this mapping and return a json result. for example.
@RestController
@RequestMapping(value = "handle")
public class HttpErrorController {
@RequestMapping(value = "404")
public String handle404() {
return "404 error";
}
}