错误的映射 swagger ui

Wrong mapping swagger ui

我试图在 link localhost:8081/swagger-ui.html 上查看 swagger 和 springfox 生成的 api 文档,但我收到错误 configuration/ui Failed to load resource: the server responded with a status of 404 (Not Found)

我检查了一下,发现 configuration/ui 的正确 url 是 swagger-resources/configuration/ui

依赖关系:

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

如何解决这个错误的映射?

将两个 swagger 版本都更改为 2.7.0

<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>