springdoc / springdoc-openapi

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
3.31k stars 501 forks source link

Issue Description: Swagger UI not accessible with Spring WebFlux #2616

Closed danielbradea closed 5 months ago

danielbradea commented 5 months ago

Summary: I've encountered an issue where Swagger UI is not accessible in my Spring WebFlux application despite configuring it with springdoc-openapi-starter-webflux-api.

Steps to Reproduce:

Set up a Spring WebFlux project.
Include springdoc-openapi-starter-webflux-api dependency.
Start the application.
Attempt to access Swagger UI via http://localhost:8080/swagger-ui.html.

Expected Behavior: I expect Swagger UI to be accessible, allowing me to interact with the API documentation.

Actual Behavior: When trying to access http://localhost:8080/swagger-ui.html, I receive a 404 error indicating that the resource cannot be found.

Additional Information:

The OpenAPI JSON documentation endpoint (http://localhost:8080/v3/api-docs) returns the expected API documentation.
I've verified the configuration and dependencies, and they seem to be correct.
There are no relevant errors or warnings in the application logs.

Environment:

Spring Boot version: 3.3.0
springdoc-openapi-starter-webflux-api version: 2.5.0
Java version: 17
makhtardiouf commented 5 months ago

Hello @danielbradea. How did you resolve this issue ? For the me the ui loads, but without any documentation generated for my controllers .

dreamstar-enterprises commented 2 months ago

I have the same issue. OpenDocs loads, http://localhost:8080/v3/api-docs, but not http://localhost:8080/swagger-ui.html - it keeps saying 404 not found

ApacheScribe commented 2 months ago

Hi, I got it to work with the following pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.10</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
17 3.0.5 jacoco reuseReports ${project.basedir}/target/jacoco.exec 2023.0.1 1.5.3.Final org.springframework.boot spring-boot-starter-webflux org.yaml snakeyaml org.yaml snakeyaml 2.0 org.springdoc springdoc-openapi-starter-webflux-ui 2.2.0 org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-data-redis-reactive org.springframework.boot spring-boot-starter-validation org.springframework.boot spring-boot-starter-mail io.micrometer micrometer-registry-prometheus runtime org.bouncycastle bcprov-jdk18on 1.78 jakarta.xml.bind jakarta.xml.bind-api 4.0.0 jakarta.xml.soap jakarta.xml.soap-api 3.0.0 jakarta.activation jakarta.activation-api 2.1.1 com.sun.xml.messaging.saaj saaj-impl 3.0.1 org.glassfish.jaxb jaxb-runtime 3.0.2 org.webjars webjars-locator-core com.icegreen greenmail 2.0.1 org.springframework.cloud spring-cloud-starter-bootstrap org.bouncycastle bcprov-jdk18on org.springframework.cloud spring-cloud-starter-config org.bouncycastle bcprov-jdk15on org.springframework.boot spring-boot-configuration-processor true org.projectlombok lombok true org.mapstruct mapstruct ${org.mapstruct.version} com.github.loki4j loki-logback-appender 1.5.1 com.github.ulisesbocchio jasypt-spring-boot-starter ${jasypt.version} org.springframework.boot spring-boot-starter-test test io.projectreactor reactor-test test

No extra configurations or class annotations. I didn't even add the @EnableSwagger... something to the @springbootapplication class. I don't know where the bug is but this seemed to work. If you have any other questions about another part of my setup, I'd be happy to answer.

LIGHT UNTO THEE LIFE UNTO THEE SUN MAY THOUGH BE TO THE CYCLE ABOVE