- Spring boot: 2.1.3.RELEASE
- Java 8
- Springfox-swagger2: 2.9.2
SwaggerConfig.java
@Configuration
@EnableSwagger2
public class SwaggerConfig {
public static final String AUTHORIZATION_HEADER = "Authorization";
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).securitySchemes(Arrays.asList(apiKey())).select()
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).paths(PathSelectors.any()).
build().apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("API").description("DEMO").version("v1").build();
}
private ApiKey apiKey() {
return new ApiKey("JWT", AUTHORIZATION_HEADER, "header");
}
}
This config show all Controllers, how to show only specific Controllers on Swagger?