springboot 3.2.10 和 springdoc-openapi 2.2.0 没有静态资源 swagger-ui/index.html

问题描述 投票:0回答:1

升级到 spring boot 3.2.10 和 springdoc-openapi-starter-webflux-ui 2.2.0 后,无法加载 swagger UI 并出现以下错误:

org.springframework.web.servlet.resource.NoResourceFoundException: No static resource swagger-ui/index.html.

以下是使用的配置:

pom 依赖项:

    
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.10</version>
    <relativePath />
    <!-- lookup parent from repository -->
</parent>
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
    <version>2.2.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

招摇配置:

@Configuration
public class SwaggerConfig {

    @Value("${Host:}")
    private String configUrl;

    @Bean
    public OpenAPI OpenApi() {
        Contact contact = new Contact();
        contact.setName("Team ");
        contact.setEmail("email.com");
        OpenAPI openAPI = new OpenAPI();
        if (StringUtils.isNotEmpty(configUrl)) {
            openAPI.addServersItem(
                    new Server().url(configUrl));
        }
        openAPI.info(new Info().title(" Scheduler API")
                .description("To schedulejobs").version("0.0.1-SNAPSHOT")
                .contact(contact)

        );

        return openAPI;
    }
}

java swagger swagger-ui springdoc-openapi-ui spring-boot-3
1个回答
0
投票

springdoc-openapi-starter-webflux-ui 更改为 springdoc-openapi-starter-webmvc-ui

© www.soinside.com 2019 - 2024. All rights reserved.