1 异常编号和提示信息统一管理

  利用枚举来实现异常的统一管理

  SpringBoot07 异常枚举、自定义异常、统一的全局异常处理

package cn.xiangxu.springboottest.enums;

import lombok.Getter;

/**
 * Girl相关异常
 */
@Getter
public enum GirlEnum {
    CONTENT_EMPTY(11, "无任何girl数据")
    ;
    private Integer code;
    private String message;

    GirlEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
View Code

相关文章:

  • 2021-09-01
  • 2021-10-11
  • 2022-02-10
  • 2022-12-23
  • 2021-09-29
  • 2021-10-16
  • 2022-01-10
  • 2021-10-07
猜你喜欢
  • 2021-07-05
  • 2021-08-20
  • 2021-09-18
  • 2022-01-13
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
相关资源
相似解决方案