Code snippet: Swagger + Spring Boot

compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'io.springfox:springfox-swagger-ui:2.9.2'
 public class SwaggerConfig {
 @Value("${enable.swagger}")  //You may want to disabled it in PROD
 boolean enableSwagger;
 public Docket api() {
     Docket api = new Docket(DocumentationType.SWAGGER_2)
        ApiInfo apiInfo = new ApiInfoBuilder()		
                .title("Xxx Doc")



        return api;

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.