SpringBoot 接口异常统一处理

当接口出现未知异常时, 如何返回统一的信息? Response.java: package com.ncucoder.collector.vo; import lombok.Data; import lombok.NoArgsConstructor; /** * @author <a href="https://hsowan.me">hsowan</a> **/ @Data @NoArgsConstructor public class Response { private Integer code; private Object body; public Response(Integer code, Object body) { this.code = code; this.body = body; } } ...

August 13, 2019 · 1 min · K8sCat