Search code examples
javaspring-bootswagger-uiopenapispringdoc

Spring Boot 3.0.0 and Springdoc incompatible?


I have a barebones SpringBoot project, with the latest Springdoc dependency (as of this writing) in the pom file:

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

In addition I only have the web starter dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

It works fine with Spring Boot 2.7.5. On local machine, I can go to http://localhost:8080/swagger-ui.html and http://localhost:8080/v3/api-docs and be redirected to the OpenAPI resources. However, once I change Spring Boot version to 3.0.0 and restart the application, I only get 404 NOT FOUND on the above two resources.

Has anyone found a way to make this work with Spring Boot 3.0.0?


Solution

  • You must use SpringDoc 2

    https://springdoc.org/v2/

    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>2.0.0</version>
    </dependency>