首页 > 技术文章 > 12.19 异常捕获补充

tanghao666 2017-12-19 09:58 原文

在自定义异常中,状态值默认200,

注意一般成功状态值为200,失败状态值定位403 405 或者其他

public class ResponseBanExcetion extends  RuntimeException{

}

  异常捕获及状态值更改

 @ExceptionHandler(value = ResponseBanExcetion.class)
@ResponseStatus(HttpStatus.FORBIDDEN)
    public ModelAndView handlerAuthorizeException() {
       }

  

 

  

:

推荐阅读