Swagger 2 with Spring Boot

Viewed 26

I'm tryng integrate swagger 2 in spring boot through springfox dependency, but continuous returning 404 error.

Here is my dependencies:

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

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>

My class SwaggerConfig:

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("projeto.locadora.locadora"))
                .paths(PathSelectors.ant("/**"))
                .build();
    }
}

And i'm trying acess by : localhost:8080/swagger-ui.html

0 Answers
Related