SpringBoot整合Swagger3

一、使用idea创建一个SpringBoot项目

二、导入jar包

swagger在3.0.0版本,只需简单的几个配置即可!

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

三、在启动类上添加@EnableOpenApi

启动项目后,访问地址:http://localhost:port/swagger-ui/index.html

至此,已经可以简单访问到swagger!

四、Swagger页面优化

导入jar包

<dependency>
    <groupId>com.github.xiaoymin</groupId>
    <artifactId>swagger-bootstrap-ui</artifactId>
    <version>1.9.6</version>
</dependency>

访问地址:http://localhost:port/doc.html

项目demo地址:https://github.com/kanie-life/perception

posted @ 2020-12-01 21:05  kanie_life  阅读(98)  评论(0编辑  收藏  举报