iamjoshua
iamjoshua

Reputation: 1269

Springfox 3.0 not working in Spring framework

I have a Spring application. I am trying to migrate it to Springfox 3.0 from Springfox 2.9.2.

It is already working on old Springfox dependencies, but with 3.0, I can't access any of the documentation at all. As far as I know, all I just need to do is add the Springfox dependecy below:

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

And remove all Springfox 2.9.2 configurations/beans. And it should work alright.

I tried accessing the Swagger UI docs via

/swagger-ui
/swagger-ui/
/swagger-ui/#/
/swagger-ui/index.html

Still, its not accessible. The microservice compiles successfully with mvn clean install. What do I do to make Springfox 3.0 work?

Upvotes: 0

Views: 1010

Answers (1)

Jo&#227;o Dias
Jo&#227;o Dias

Reputation: 17510

You still need to keep the following basic configuration:

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

You may want to check the migration guide here.


I strongly suggest you move to springdoc, which is a more recent library, way less buggy and much easier to work with. Take a look at:

Upvotes: 0

Related Questions