看到在controller中存在这样的注解,也是第一次发现这样的注解
百度一下,还挺简单
/**
* 系统发布审批
* @param completeExecutionEntity
* @return
*/
@RequestMapping(value = "/systemDeployment/deploymentApproval", method = { RequestMethod.POST })
@ApiOperation(value = "系统发布审批", tags = "系统发布审批controller", position = 2)
public Object deploymentApproval(final CompleteExecutionEntity completeExecutionEntity) {
FlowMainEntity flowMainEntity = this.systemDeploymentService.completeTest(completeExecutionEntity);
return PuristWorkflowResponse.success(flowMainEntity);
}
@ApiOperation不是spring自带的注解是swagger里的
com.wordnik.swagger.annotations.ApiOperation;
@ApiOperation和@ApiParam为添加的API相关注解,个参数说明如下:
@ApiOperation(value = “接口说明”, httpMethod = “接口请求方式”, response = “接口返回参数类型”, notes = “接口发布说明”;其他参数可参考源码;
@ApiParam(required = “是否必须参数”, name = “参数名称”, value = “参数具体描述”
实际项目中非常需要写文档,提高Java服务端和Web前端以及移动端的对接效率。
Swagger是当前最好用的Restful API文档生成的开源项目,通过swagger-spring项目
实现了与SpingMVC框架的无缝集成功能,方便生成spring restful风格的接口文档,
同时swagger-ui还可以测试spring restful风格的接口功能。