路在脚下,心向远方

springboot系列-全局异常处理

GlobalExceptionHandler package com.example.basedemo.globexception; /* * @Description: 请输入.... * @Author: 麦子 * @Date: 2019-06-24 10:52:09 * @LastEditTime: 2019-06-24 10:54:04 * @LastEditors: 麦子 */ import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; @ControllerAdvice public class GlobalExceptionHandler { public static final String DEFAULT_ERROR_VIEW = "errorPrompt"; /*** * 页面错误 * @param req * @param e * @return