Created
December 15, 2020 05:23
-
-
Save umardraz670/ff6f4b48d78379be867ecef6888c36a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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