content: package com.urunov.configure;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
  import springfox.documentation.builders.ApiInfoBuilder;
  import springfox.documentation.builders.RequestHandlerSelectors;
  import springfox.documentation.service.ApiInfo;
  import springfox.documentation.service.Contact;
  import springfox.documentation.spi.DocumentationType;
  import springfox.documentation.spring.web.plugins.Docket;
  import springfox.documentation.swagger2.annotations.EnableSwagger2;
  
  import static springfox.documentation.builders.PathSelectors.regex;
  
  /**
   * Created by:
   * User: hamdamboy
   * Project: IntelliJ IDEA
   * Github: @urunov
   */
  
  @Configuration
  @EnableSwagger2
  public class SwaggerConfig extends WebMvcConfigurationSupport {
  
      @Bean
      public Docket postsApi() {
  
          return new Docket(DocumentationType.SWAGGER_2)
                  .select()
                  .apis(RequestHandlerSelectors.basePackage("com.urunov.controller"))
                  .paths(regex("/api.*"))
                  .build()
                  .apiInfo(metaData());
      }
  
      private ApiInfo metaData() {
          return new ApiInfoBuilder()
                  .title("Full Stack: Spring Boot and React JS for the Shopping Mall")
                  .description("\"Shopping Mall")
                  .version("1.0.0")
                  .license("Apache License Version 2.0")
                  .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0\"")
                  .contact(new Contact("Urunov Hamdamboy", "https://github.com/urunov/", "myindexu@gamil.com"))
                  .build();
      }
  
      @Override
      protected void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("swagger-ui.html")
                  .addResourceLocations("classpath:/META-INF/resources/");
          registry.addResourceHandler("/webjars/**")
                  .addResourceLocations("classpath:/META-INF/resources/webjars/");
      }
  }
  