Introducing POM Dependencies:
<Dependency> <groupId>Io.springfox</groupId> <Artifactid>Springfox-swagger2</Artifactid> <version>2.7.0</version> </Dependency> <Dependency> <groupId>Io.springfox</groupId> <Artifactid>Springfox-swagger-ui</Artifactid> <version>2.7.0</version> </Dependency>
To GitHub https://github.com/swagger-api/swagger-ui to download the project, the Dist directory is copied and placed directly into the resource path.
index.html is the API page
Then add annotations to the spring boot startup class @EnableSwagger2
@SpringBootApplication @EnableSwagger2 Public class neteaseapplication { publicstaticvoid main (string[] args) { Springapplication.run (neteaseapplication. class , args);} }
API Address:http://localhost:8080/api/index (address is determined by the stored Resource path folder)
Api-json:http://localhost:8080/v2/api-docs
Swagger2 Common notes: 76522486
Spring Boot uses the Swagger UI