Skip to content

Instantly share code, notes, and snippets.

@umardraz670
Created December 15, 2020 05:23
Show Gist options
  • Save umardraz670/ff6f4b48d78379be867ecef6888c36a4 to your computer and use it in GitHub Desktop.
Save umardraz670/ff6f4b48d78379be867ecef6888c36a4 to your computer and use it in GitHub Desktop.
package com.webtutsplus.ecommerce.config.documentation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
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;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(getApiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.webtutsplus.ecommerce"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo getApiInfo() {
Contact contact = new Contact("Umar Draz", "-", "umar.umar82@gmail.com");
return new ApiInfoBuilder()
.title("User Profile API")
.description("Documentation User profile api")
.version("1.0.0")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
.contact(contact)
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment