|
@@ -1,48 +1,48 @@
|
|
|
-/*
|
|
|
- * *************************************************
|
|
|
- * Copyright (c) 2018 QMTH. All Rights Reserved.
|
|
|
- * Created by Deason on 2018-10-17 16:34:17.
|
|
|
- * *************************************************
|
|
|
- */
|
|
|
-
|
|
|
package cn.com.qmth.examcloud.core.print.config;
|
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
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.EnableSwagger2WebMvc;
|
|
|
|
|
|
-/**
|
|
|
- * @author: QMTH
|
|
|
- * @since: 2018/10/17
|
|
|
- */
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@Configuration
|
|
|
@EnableSwagger2WebMvc
|
|
|
public class SwaggerConfig {
|
|
|
|
|
|
@Bean
|
|
|
public Docket buildDocket() {
|
|
|
+ List<Parameter> parameters = new ArrayList<>();
|
|
|
+ parameters.add(new ParameterBuilder().name("key").modelRef(new ModelRef("String")).parameterType("header").required(false).build());
|
|
|
+ parameters.add(new ParameterBuilder().name("token").modelRef(new ModelRef("String")).parameterType("header").required(false).build());
|
|
|
+
|
|
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
|
- .groupName("Version 3.0")
|
|
|
+ .groupName("default")
|
|
|
.apiInfo(buildApiInfo())
|
|
|
+ .globalOperationParameters(parameters)
|
|
|
.useDefaultResponseMessages(false)
|
|
|
.select()
|
|
|
- .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
|
|
+ // .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
|
|
+ .apis(RequestHandlerSelectors.basePackage("cn.com.qmth.examcloud.core.print.api.controller"))
|
|
|
.paths(PathSelectors.any())
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
public ApiInfo buildApiInfo() {
|
|
|
return new ApiInfoBuilder()
|
|
|
- .title("印刷平台接口文档")
|
|
|
- .version("3.0")
|
|
|
+ .title("考试云平台接口文档")
|
|
|
+ .version("v4.x.x")
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|