@RestControllerAdvice public class GlobalExceptionHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
GlobalExceptionHandler() |
| Modifier and Type | Method and Description |
|---|---|
cn.sinozg.applet.common.core.base.BaseResponse<String> |
argumentNotValidException(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.MethodArgumentNotValidException e)
请求参数异常处理
|
cn.sinozg.applet.common.core.base.BaseResponse<String> |
cavException(javax.servlet.http.HttpServletRequest request,
cn.sinozg.applet.common.exception.CavException e)
业务异常处理
|
cn.sinozg.applet.common.core.base.BaseResponse<String> |
jsonHandler(javax.servlet.http.HttpServletRequest request,
Exception e)
在controller里面内容执行之前,
校验一些参数不匹配啊,
Get post方法不对啊之类的
|
@ResponseBody @ExceptionHandler(value=java.lang.Exception.class) public cn.sinozg.applet.common.core.base.BaseResponse<String> jsonHandler(javax.servlet.http.HttpServletRequest request, Exception e)
request - HttpServletRequeste - 异常@ResponseBody @ExceptionHandler(value=cn.sinozg.applet.common.exception.CavException.class) public cn.sinozg.applet.common.core.base.BaseResponse<String> cavException(javax.servlet.http.HttpServletRequest request, cn.sinozg.applet.common.exception.CavException e)
request - HttpServletRequeste - 异常@ResponseBody @ExceptionHandler(value=org.springframework.web.bind.MethodArgumentNotValidException.class) public cn.sinozg.applet.common.core.base.BaseResponse<String> argumentNotValidException(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.MethodArgumentNotValidException e)
request - HttpServletRequeste - 异常Copyright © 2024. All rights reserved.