![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
异常
文章平均质量分 62
-星雨-
缘不知所起
展开
-
@ControllerAdvice
Spring Boot全局异常1 @ControllerAdvice1.1 basePackages1.2 basePackageClasses1.3 assignableTypes1.4 annotations2 示例1 @ControllerAdvice@ExceptionHandler(Exception.class)注解,表示当控制器抛出Exception异常时,将会委托该方法来处理。@controllerAdvice最为实用的一个场景就是将所有@ExceptionHandler方法收集到一个转载 2021-06-18 16:15:28 · 1500 阅读 · 0 评论 -
SpringBoot自定义异常信息
SpringBoot自定义异常信息/** * 异常状态实体枚举类 */public enum ResultCode { SUCCESS("0", "成功"), ERROR("-1", "系统异常"), PARAM_ERROR("1001", "参数异常"), USER_EXIST_ERROR("2001", "用户已存在"), USER_ACCOUNT_ERROR("2002", "账号或密码错误"), USER_NOT_EXIST_ERROR("20原创 2021-06-17 22:50:51 · 268 阅读 · 0 评论