Search code examples
javaswaggerswagger-uispringdoc-openapi-uispring-boot-3

No static resource swagger-ui/index.html with springboot 3.2.10 and springdoc-openapi 2.2.0


Unable to load swagger UI and getting the below error after upgrading to spring boot 3.2.10 and springdoc-openapi-starter-webflux-ui 2.2.0 :

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

Below are the configurations used :

pom dependencies :

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

swagger config:

@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;
    }
}


Solution

  • Change springdoc-openapi-starter-webflux-ui to springdoc-openapi-starter-webmvc-ui