Susana González
Susana González

Reputation: 31

404 error on Spring Boot 3.0.2 and springdoc v2

I have the following springbootframework version:

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

and I have declared the dependency as the web sais (https://springdoc.org/v2/)

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

When I go to: http://localhost:8080/index.html I get error 404. I do not have any additional config. I don't have any context path overriden on application properties. What do you think I may be missing?

Using Java 17 (.jdks\corretto-17.0.6\bin\java.exe) According to https://github.com/springdoc/springdoc-openapi/releases spring doc 2.1.0 should be compatible with spring-boot-starter-parent with 3.0.2

Upvotes: 1

Views: 590

Answers (1)

Susana Gonz&#225;lez
Susana Gonz&#225;lez

Reputation: 31

I found the problem. Not only the dependency springdoc-openapi-starter-webmvc-ui is needed. As I had Webflux as dependency I needed to add:

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
            <version>2.0.4</version>
        </dependency>

And if validation probles appear, make sure you have

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

Upvotes: 1

Related Questions