|
@@ -3,6 +3,7 @@ package com.its.op.config;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
+import springfox.documentation.RequestHandler;
|
|
import springfox.documentation.builders.ApiInfoBuilder;
|
|
import springfox.documentation.builders.ApiInfoBuilder;
|
|
import springfox.documentation.builders.ParameterBuilder;
|
|
import springfox.documentation.builders.ParameterBuilder;
|
|
import springfox.documentation.builders.PathSelectors;
|
|
import springfox.documentation.builders.PathSelectors;
|
|
@@ -16,6 +17,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.function.Predicate;
|
|
|
|
|
|
//@Profile("dev|swagger")
|
|
//@Profile("dev|swagger")
|
|
@Configuration
|
|
@Configuration
|
|
@@ -34,12 +36,19 @@ public class SwaggerConfig {
|
|
|
|
|
|
List<Parameter> globalParameters = new ArrayList<>();
|
|
List<Parameter> globalParameters = new ArrayList<>();
|
|
globalParameters.add(parameterBuilder);
|
|
globalParameters.add(parameterBuilder);
|
|
|
|
+ Predicate<RequestHandler> predicate = RequestHandlerSelectors.basePackage("com.its.op.controller")
|
|
|
|
+ .or(RequestHandlerSelectors.basePackage("com.its.op.dto.validate"));
|
|
|
|
+// List<Predicate<RequestHandler>> predicateList = new ArrayList<>();
|
|
|
|
+// predicateList.add(RequestHandlerSelectors.basePackage("com.its.op.controller"));
|
|
|
|
+// predicateList.add(RequestHandlerSelectors.basePackage("com.its.op.dto.validate"));
|
|
|
|
+
|
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
.globalOperationParameters(globalParameters)
|
|
.globalOperationParameters(globalParameters)
|
|
.groupName("its-api")
|
|
.groupName("its-api")
|
|
.apiInfo(this.apiInfo())
|
|
.apiInfo(this.apiInfo())
|
|
.select()
|
|
.select()
|
|
- .apis(RequestHandlerSelectors.basePackage("com.its.op.controller"))
|
|
|
|
|
|
+ //.apis(RequestHandlerSelectors.basePackage("com.its.op.controller"))
|
|
|
|
+ .apis(predicate::test)
|
|
.paths(PathSelectors.any())
|
|
.paths(PathSelectors.any())
|
|
//.paths(PathSelectors.ant("/api/**"))
|
|
//.paths(PathSelectors.ant("/api/**"))
|
|
.build();
|
|
.build();
|