/**
* 全局捕获异常
*/
@ControllerAdvice(basePackages = "com.xx.api.impl")
public class GlobalExceptionHandler {
@ExceptionHandler(RuntimeException.class)
@ResponseBody
public Map<String, Object> errorResult() {
Map<String, Object> errorResultMap = new HashMap<String, Object>();
errorResultMap.put("code", "500");
errorResultMap.put("msg", "系统出现错误!");
return errorResultMap;
}
}
全局捕获异常
最新推荐文章于 2024-04-18 19:10:26 发布