- 问题复现 如下
- timestamp: "2022-10-11T10:22:37.932+00:00", status: 302, error: "Found",…}
- error: "Found"
- exception: "com.myblog.exception.blogApiException"
- message: ""
- path: "/myblog/hello"
- status: 302
- timestamp: "2022-10-11T10:22:37.932+00:00"
- springboot 2.0以上版本 返回的异常信息 message 为空 需要在配置文件中指定server的异常对象和异常信息,在yml文件中,添加配置
-
server: error: include-exception: true include-message: always
- 配置后即可正常显示异常对象和异常对象
- timestamp: "2022-10-11T10:22:37.932+00:00", status: 302, error: "Found",…}
- error: "Found"
- exception: "com.myblog.exception.blogApiException"
- message: "编号01重复"
- path: "/myblog/hello"
- status: 302
- timestamp: "2022-10-11T10:22:37.932+00:00"
springboot 自定义异常 捕获的异常信息 前端接收到的message为空
最新推荐文章于 2023-10-24 10:18:59 发布