本项目是为了解决HTTP
接口返回统一格式的JSON body
这个问题。
JDK 1.8
或以上版本maven 3.1.0
或以上版本- 需要开发工具安装
lombok
插件
- 运行
SpringWebParamValidateDemoApplication
的main
方法即可启动项目 - 然后在浏览器中进行以下操作就可以看到统一响应体的示例运行效果了
- 在浏览器直接访问
http://127.0.0.1:8080/users/0
,则返回结果如下(结果经过格式化处理):{ "code": 10001, "msg": "资源不存在", "data": null }
- 在浏览器直接访问