介紹html
swagger用註解的方式生成接口文檔,減小工做量spring
使用spring-boot
首先須要引入jarui
<!-- 引入swagger2 --> <dependency> <groupId>com.spring4all</groupId> <artifactId>swagger-spring-boot-starter</artifactId> <version>1.8.0.RELEASE</version> </dependency>
而後在controller中引入註解spa
@Api(value ="/login" ,tags={"登陸註冊"})
在方法上也引入註解code
@ApiOperation("用戶登陸")
@ApiImplicitParams({
@ApiImplicitParam(name = "tel",value="手機號",required = true),
@ApiImplicitParam(name = "password",value="密碼",required = true)
})
效果htm
經過訪問本地 http://localhost:9004/swagger-ui.html#/ 既能夠看到生成的接口文檔的效果blog