给pom.xml增加下面的依赖项:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.8</version>
</dependency>
给 properties文件增加下面的选项
springdoc.swagger-ui.path=/swagger-ui.html
访问你的api文档
比如 http://localhost:8080/swagger-ui.html
![swagger UI](https://img-blog.csdnimg.cn/20201102215134209.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3N1cmZpcnN0,size_16,color_FFFFFF,t_70#pic_center)
源码
https://github.com/surfirst/springboot-lessons