SpringBoot 中使用 Swagger2 出现 whitelabel page error 解决方法
阅读原文时间:2023年07月08日阅读:1

今天使用Swagger最新版,在pom.xml引入

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>3.0.0</version>
    </dependency>

其他弄好后,访问 http://localhost:8080/swagger-ui.html 出现如题错误。

解决方案如下:

替换pom.xml内容为

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

访问: http://localhost:8080/swagger-ui/

注意最后的斜杠/不能少