Skip to content

Instantly share code, notes, and snippets.

@mohashari
Last active August 25, 2019 12:02
Show Gist options
  • Select an option

  • Save mohashari/0cbb3a01aec157a233835e61e1688f17 to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/0cbb3a01aec157a233835e61e1688f17 to your computer and use it in GitHub Desktop.
file java configuration swagger
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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;
import java.util.ArrayList;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
Contact contact = new Contact("monggopesen","url","developer@monggopesen.com");
String description = "this is documentation Api Main Service";
String version = "0.1" ;
String termOfService = "Term Of Service";
String license = "license";
String licenseUrl = "licenseUrl";
Docket docket = new Docket(DocumentationType.SWAGGER_12)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex("/api/.*"))
.build()
.apiInfo( new ApiInfo("Main Service",
description,
version,
termOfService,
contact,
license,
licenseUrl,
new ArrayList<>()));
return docket;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment