|
@@ -0,0 +1,55 @@
|
|
|
+package com.its.vds.config;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import springfox.documentation.builders.ApiInfoBuilder;
|
|
|
+import springfox.documentation.builders.ParameterBuilder;
|
|
|
+import springfox.documentation.builders.PathSelectors;
|
|
|
+import springfox.documentation.builders.RequestHandlerSelectors;
|
|
|
+import springfox.documentation.schema.ModelRef;
|
|
|
+import springfox.documentation.service.ApiInfo;
|
|
|
+import springfox.documentation.service.Parameter;
|
|
|
+import springfox.documentation.spi.DocumentationType;
|
|
|
+import springfox.documentation.spring.web.plugins.Docket;
|
|
|
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Configuration
|
|
|
+@EnableSwagger2
|
|
|
+public class SwaggerConfig {
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public Docket commonApi() {
|
|
|
+ Parameter parameterBuilder = new ParameterBuilder()
|
|
|
+ .name(HttpHeaders.AUTHORIZATION)
|
|
|
+ .description("Access Token")
|
|
|
+ .modelRef(new ModelRef("string"))
|
|
|
+ .parameterType("header")
|
|
|
+ .required(false)
|
|
|
+ .build();
|
|
|
+
|
|
|
+ List<Parameter> globalParameters = new ArrayList<>();
|
|
|
+ globalParameters.add(parameterBuilder);
|
|
|
+ return new Docket(DocumentationType.SWAGGER_2)
|
|
|
+ .globalOperationParameters(globalParameters)
|
|
|
+ .groupName("vds-api")
|
|
|
+ .apiInfo(this.apiInfo())
|
|
|
+ .select()
|
|
|
+ .apis(RequestHandlerSelectors.basePackage("com.its.vds.api.controller"))
|
|
|
+ .paths(PathSelectors.any())
|
|
|
+ //.paths(PathSelectors.ant("/api/**"))
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+ private ApiInfo apiInfo() {
|
|
|
+ return new ApiInfoBuilder()
|
|
|
+ .title("VDS Control API")
|
|
|
+ .description("VDS Communication Server API")
|
|
|
+ .version("0.0.1")
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|