Question : Spring Boot Error Controller
Answered by : pragya-keshap
{"tags":[{"tag":"p","content":"Spring "},{"tag":"textarea","content":"@Component\npublic class MyCustomErrorAttributes extends DefaultErrorAttributes {\n\n @Override\n public Map<String, Object> getErrorAttributes(\n WebRequest webRequest, ErrorAttributeOptions options) {\n Map<String, Object> errorAttributes = \n super.getErrorAttributes(webRequest, options);\n errorAttributes.put(\"locale\", webRequest.getLocale()\n .toString());\n errorAttributes.remove(\"error\");\n\n \/\/...\n\n return errorAttributes;\n }\n}\nCopy","code_language":"java"}]}
Source : https://www.baeldung.com/exception-handling-for-rest-with-spring | Last Update : Wed, 08 Mar 23