检测到无效的映射模式:/**/swagger-ui/**

我正在将 springdoc-openapi-ui 用于 Spring Boot API 文档并面临以下问题 -

I am using springdoc-openapi-ui for spring boot API documentation and facing the following issue -

我已经添加了所有必要的配置如下 -

I have added all the necessary configuration as follows -

  1. maven 依赖 -

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.2</version>
</dependency>

  1. 这是主文件 -

package com.abc.tl;
    
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@OpenAPIDefinition
public class TLApplication {

    public static void main(String[] args) {

        SpringApplication.run(TLApplication.class, args);

    }
}


使用java版本-11,不确定问题出在哪里,项目无法运行.

Using java version - 11, Not sure where is the Issue, the project is not able to run.

推荐答案

通过以下依赖,解决了这个问题.

With following dependencies, solved this issue.

 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.0</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.5.12</version>
</dependency>

相关文章