2024.6.3 Monday
接上文【WEEK14】 【DAY5】Swagger第三部分【中文版】
目录
- 16.9.拓展:其他皮肤
- 16.9.1.修改pom.xml
- 16.9.2.重启并分别访问对应的网址
- 16.9.2.1.swagger-ui
- 16.9.2.2.bootstrap-ui
- 16.9.2.3.Layui-ui
- 16.9.2.4.mg-ui
16.9.拓展:其他皮肤
16.9.1.修改pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.13</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>swagger-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>swagger-demo</name>
<description>swagger-demo</description>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!--默认的 访问 http://localhost:8080/swagger-ui.html-->
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!--bootstrap-ui 访问 http://localhost:8080/doc.html-->
<!-- 引入swagger-bootstrap-ui包 /doc.html-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.1</version>
</dependency>
<!--Layui-ui 访问 http://localhost:8080/docs.html-->
<!-- 引入swagger-ui-layer包 /docs.html。但是这个无法看到正确的展示页-->
<dependency>
<groupId>com.github.caspar-chen</groupId>
<artifactId>swagger-ui-layer</artifactId>
<version>1.1.3</version>
</dependency>
<!--mg-ui 访问 http://localhost:8080/document.html-->
<!-- 引入swagger-ui-layer包 /document.html-->
<dependency>
<groupId>com.zyplayer</groupId>
<artifactId>swagger-mg-ui</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
16.9.2.重启并分别访问对应的网址
16.9.2.1.swagger-ui
http://localhost:8080/swagger-ui.html
16.9.2.2.bootstrap-ui
http://localhost:8080/doc.html
16.9.2.3.Layui-ui
http://localhost:8080/docs.html
应该长这样
16.9.2.4.mg-ui
http://localhost:8080/document.html