快速上手Swagger(springboot2+ Swagger)

SpringBoot已经集成了Swagger,使用简单注解即可生成swagger的API文档

1)引入依赖
快速上手Swagger(springboot2+ Swagger)_第1张图片

2)编写配置

3)接口声明
在controller的每个handler上添加接口说明注解:

注:常用注解说明
快速上手Swagger(springboot2+ Swagger)_第2张图片

4)启动项目测试
启动服务,然后访问:http://localhost:端口号/swagger-ui.html

你可能感兴趣的:(工具使用,swagger)