|
| 1 | +package com.webservice.mobile.app; |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +import org.springframework.context.annotation.Bean; |
| 7 | +import org.springframework.context.annotation.Configuration; |
| 8 | +import springfox.documentation.builders.PathSelectors; |
| 9 | +import springfox.documentation.builders.RequestHandlerSelectors; |
| 10 | +import springfox.documentation.service.ApiInfo; |
| 11 | +import springfox.documentation.service.Contact; |
| 12 | +import springfox.documentation.service.VendorExtension; |
| 13 | +import springfox.documentation.spi.DocumentationType; |
| 14 | +import springfox.documentation.spring.web.plugins.Docket; |
| 15 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 16 | + |
| 17 | +import java.util.ArrayList; |
| 18 | +import java.util.Arrays; |
| 19 | +import java.util.HashSet; |
| 20 | +import java.util.List; |
| 21 | + |
| 22 | + |
| 23 | +@Configuration |
| 24 | +@EnableSwagger2 |
| 25 | +public class SwaggerConfig { |
| 26 | + |
| 27 | + Contact contact = new Contact( |
| 28 | + "Raj Singha", |
| 29 | + "https://rajsingha.codes", |
| 30 | + |
| 31 | + ); |
| 32 | + |
| 33 | + List<VendorExtension> vendorExtensions = new ArrayList<>(); |
| 34 | + |
| 35 | + ApiInfo apiInfo = new ApiInfo( |
| 36 | + "Mobile App WebService - RESTful Web Service Documentation ", |
| 37 | + "This pages documents Mobile App WebService RESTful Web Service Endpoints", |
| 38 | + "1.0",null, |
| 39 | + contact, |
| 40 | + "Apache 2.0", |
| 41 | + "http://www.apache.org/licenses/LICENSE-2.0", |
| 42 | + vendorExtensions); |
| 43 | + |
| 44 | + @Bean |
| 45 | + public Docket apiDocket(){ |
| 46 | + Docket docket = new Docket(DocumentationType.SWAGGER_2) |
| 47 | + .protocols(new HashSet<>(Arrays.asList("HTTP","HTTPs"))) |
| 48 | + .apiInfo(apiInfo) |
| 49 | + .select() |
| 50 | + .apis(RequestHandlerSelectors.basePackage("com.webservice.mobile.app")) |
| 51 | + .paths(PathSelectors.any()) |
| 52 | + .build(); |
| 53 | + return docket; |
| 54 | + } |
| 55 | +} |
0 commit comments