SpringBoot——统一 接口返回值和全局异常处理
统一接口返回值
1、定义通用的数据返回对象
@Data
@Accessors(chain = true)
public class GlobalResponse
private Integer code;
private String message;
private T data;
private final String timeStamp = DateUtils.localDateTimeToString(LocalDateTime.now());
public static final String SUCCESS = "成功";
public static final String FAILURE = "失败";
public GlobalResponse(int code, St
共有 0 条评论