给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

源码
https://github.com/surfirst/springboot-lessons