Last active
May 12, 2018 06:05
-
-
Save chathurangat/ec36e8cfedb770ae359b7ce056366184 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
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
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; | |
@Configuration | |
@EnableSwagger2 | |
public class Swagger2Config { | |
@Bean | |
public Docket restApi() { | |
return new Docket(DocumentationType.SWAGGER_2) | |
.select() | |
.apis(RequestHandlerSelectors.basePackage("com.springbootdev.examples.swagger.controller")) | |
.build() | |
.apiInfo(getApiInfo()); | |
} | |
private ApiInfo getApiInfo() { | |
return new ApiInfoBuilder() | |
.title("Spring Boot REST API - User Management") | |
.description("\"Simple Spring Boot REST Api for managing Users\"") | |
.version("1.0.0") | |
.license("Apache License Version 2.0") | |
.licenseUrl("https://www.apache.org/licenses/LICENSE-2.0\"") | |
.contact(new Contact("Chathuranga Tennakoon", "https://www.springbootdev.com", "chathuranga.t@gmail.com")) | |
.build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment