标签:obj exception result 页面 cep code run res ase
//全局捕获异常对basePackages的包生效
@ControllerAdvice(basePackages = "com.wld.controller")
public class GlobalExpectionHandler(){
//@ExceptionHandler(RuntimeException.class)仅仅捕获RuntimeException异常类型
@ExceptionHandler(RuntimeException.class)
//@ResponseBody 返回json格式
//ModeAndView 返回页面
@ResponseBody
public Map<String,Object> errorResult(){
Map<String,Object> resultMap = new HashMap<String,Object>();
resultMap.put("errorCode", "500");
resultMap.put("errorMessage", "system Error")
return resultMap;
}
}
标签:obj exception result 页面 cep code run res ase
原文地址:https://www.cnblogs.com/wldan/p/10568913.html