swagger 配置使用说明.docx

上传人:小飞机 文档编号:3166419 上传时间:2023-03-11 格式:DOCX 页数:4 大小:37.22KB
返回 下载 相关 举报
swagger 配置使用说明.docx_第1页
第1页 / 共4页
swagger 配置使用说明.docx_第2页
第2页 / 共4页
swagger 配置使用说明.docx_第3页
第3页 / 共4页
swagger 配置使用说明.docx_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《swagger 配置使用说明.docx》由会员分享,可在线阅读,更多相关《swagger 配置使用说明.docx(4页珍藏版)》请在三一办公上搜索。

1、swagger 配置使用说明 swagger 配置使用说明 1、系统使用swagger-springmvc 0.6.6版本,后续版本系统spring无法支持。 2、相关pom配置 com.mangofactory swagger-springmvc 0.6.6 servlet-api javax.servlet spring-webmvc org.springframework spring-web org.springframework org.springframework spring-core 3.1.0.RELEASE org.springframework spring-beans

2、 3.1.0.RELEASE 3、系统配置文件 a、 , 设置系统根路径和API版本 b、wf-app-swagger.xml 设置需要查看的URI app_swagger.properties /app/. /appserver/. /user /txt/demo /.为通配符,支持子路径模糊匹配 4、类上加API注解 对contorller类添加API注解 类的头部添加API注解 类的方法上添加ApiOperation注解 Api(value = 用户, description = 有关于用户的CURD操作 ) Controller RequestMapping(/user) public

3、 class TestController ResponseBody RequestMapping(value = /addUser, method = RequestMethod.GET, produces = application/json; charset=utf-8) ApiOperation(value = addUser, notes = This can only be done by the logged in user. ,responseClass=String.class) public String addUser(ApiParam(required = true,

4、name = postData, value = 用户信息json数据) RequestParam( value = postData) String postData, HttpServletRequest request)throws JSONException JSONObject json = new JSONObject; json.put(postData, postData); return json.toString; . . API表示一个开放的API,可以通过description简要描述该API的功能。 在一个API下,可有多个ApiOperation,表示针对该API的CRUD操作。在ApiOperation Annotation中可以通过value,notes描述该操作的作用,response描述正常情况下该请求的返回对象类型。 ApiParam用于描述该API操作接受的参数类型

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号