|  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.context.annotation.Bean; | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  | import org.springframework.web.util.UriComponentsBuilder; | 
 |  |  | import springfox.documentation.PathProvider; | 
 |  |  | import springfox.documentation.RequestHandler; | 
 |  |  | import springfox.documentation.builders.ApiInfoBuilder; | 
 |  |  | import springfox.documentation.builders.ParameterBuilder; | 
 |  |  | 
 |  |  | import springfox.documentation.schema.ModelRef; | 
 |  |  | import springfox.documentation.service.ApiInfo; | 
 |  |  | import springfox.documentation.spi.DocumentationType; | 
 |  |  | import springfox.documentation.spring.web.paths.DefaultPathProvider; | 
 |  |  | import springfox.documentation.spring.web.paths.Paths; | 
 |  |  | import springfox.documentation.spring.web.plugins.Docket; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.function.Predicate; | 
 |  |  |  | 
 |  |  | import static springfox.documentation.spring.web.paths.Paths.removeAdjacentForwardSlashes; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Swagger配置 | 
 |  |  | 
 |  |  | @EnableKnife4j | 
 |  |  | public class SwaggerConfig { | 
 |  |  |  | 
 |  |  |     @Value("${swagger.host:}") | 
 |  |  |     @Value("${swagger.host}") | 
 |  |  |     private String host; | 
 |  |  |     @Value("${swagger.context-path}") | 
 |  |  |     private String contextPath; | 
 |  |  |  | 
 |  |  |     @Value("${swagger.title:接口文档}") | 
 |  |  |     private String title; | 
 |  |  |  | 
 |  |  |     @Value("${swagger.description:}") | 
 |  |  |     @Value("${swagger.description}") | 
 |  |  |     private String description; | 
 |  |  |  | 
 |  |  |     @Value("${project.version:}") | 
 |  |  |     @Value("${project.version}") | 
 |  |  |     private String version; | 
 |  |  |  | 
 |  |  |     @Bean | 
 |  |  | 
 |  |  |     } | 
 |  |  |     @Bean | 
 |  |  |     public Docket getDocket3() { | 
 |  |  |         return new Docket(DocumentationType.SWAGGER_2) | 
 |  |  |         Docket docket = new Docket(DocumentationType.SWAGGER_2) | 
 |  |  |                 .apiInfo(this.getApiInfo()).groupName("【华晟访客系统交互接口openapi】") | 
 |  |  |                 .host(host) | 
 |  |  |                 .select() | 
 |  |  | 
 |  |  |                 .paths(PathSelectors.any()) | 
 |  |  |                 .build() | 
 |  |  |                 .globalOperationParameters(this.getParameterList()); | 
 |  |  |                  docket.pathProvider(new DefaultPathProvider(){ | 
 |  |  |                      @Override | 
 |  |  |                      public String getOperationPath(String operationPath) { | 
 |  |  |                          return contextPath+super.getOperationPath(operationPath); | 
 |  |  |                      } | 
 |  |  |                  }) ; | 
 |  |  |         return docket; | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private List<Parameter> getParameterList() { | 
 |  |  |         ParameterBuilder tokenPar = new ParameterBuilder(); | 
 |  |  |         List<Parameter> pars = new ArrayList<>(); |