//全局捕获异常对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;
}
}