Spring boot 3 doesn't work with springfox 3.0

I’ve been trying to integrate swagger with spring boot. I used spring boot version 3.0.4 with springfox 3.0

Here’s my pom.xml file springfox dependency and parent

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

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

SpringfoxConfig.java


@Configuration
public class SpringFoxConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}

When I run the application and tried the url http://localhost:8080/swagger-ui/ I can’t see the swagger ui instead I’m seeing white label error.

I migrated spring-parent to 2.7.9 and enabled the swagger with @EnableSwagger. I can see the swagger now.

I’ve used the reference document from springfox. Not sure, what’s the issue with new version and how can be rectified.

>Solution :

I am sorry that as of today , springfox does not support Spring Boot 3 yet.(see this and this).

You can consider to use another similar project called springdoc and here is the migration guideline for migrating springfox to springdoc

Leave a Reply