SpringBoot 中使用 Swagger2 出现 whitelabel page error 解决方法


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

    <dependency>
        <groupId>io.springfoxgroupId>
        <artifactId>springfox-swagger2artifactId>
        <version>3.0.0version>
    dependency>
    <dependency>
        <groupId>io.springfoxgroupId>
        <artifactId>springfox-swagger-uiartifactId>
        <version>3.0.0version>
    dependency>

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

解决方案如下:
替换pom.xml内容为

<dependency>
    <groupId>io.springfoxgroupId>
    <artifactId>springfox-boot-starterartifactId>
    <version>3.0.0version>
dependency>

访问: http://localhost:8080/swagger-ui/
注意最后的斜杠/不能少

亲测好用 不用访问.html结尾的文件了

转载自 https://www.cnblogs.com/feily/p/14316532.html

相关