springboot中swagger接口文档使用
1.pom文件引用
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
2.注解:
controller注解:
//接口说明
@ApiOperation(value = "查询商品分期数据")
//接口参数
@ApiImplicitParams({
@ApiImplicitParam(value = "商品ids", name = "ids"),
})
//接口返回
@ApiResponses({
@ApiResponse(code = 0, message = "商品信息数组 siteProducts", response = SiteProduct.class)
})
entity注解:
@ApiModelProperty(value = "分期数")
private String periods;
3.启动项目后,直接通过 /doc.html 地址查询接口信息