Browse Source

更新:
swagger改配置文件

wuweihao 4 years ago
parent
commit
143f0fd751

+ 5 - 0
cms_pano_fcb/gis_application/src/main/resources/application-dev.properties

@@ -80,6 +80,11 @@ oss.type=oss
 oss.file.path=${project.name}/
 oss.domain=http://ossxiaoan.4dage.com/
 
+swagger.package=com.gis.web.controller
+swagger.title=VR720-fcb dev
+swagger.description==VR720-fcb dev
+swagger.version=1.0
+
 
 #log
 logging.path=E:/javaProject/${project.name}_log

+ 5 - 0
cms_pano_fcb/gis_application/src/main/resources/application-pro.properties

@@ -68,6 +68,11 @@ oss.type=oss
 oss.file.path=${project.name}/
 oss.domain=https://vr-oss01.fcb.com.cn/
 
+swagger.package=com.gis.web.controller
+swagger.title=VR720¡ªfcb pro 
+swagger.description=VR720¡ªpro 
+swagger.version=1.0
+
 
 #log
 logging.path=/home/tomcat/log/${project.name}_log

+ 5 - 0
cms_pano_fcb/gis_application/src/main/resources/application-sit.properties

@@ -77,6 +77,11 @@ oss.file.path=${project.name}/
 #oss.domain=http://ossxiaoan.4dage.com/
 oss.domain=https://oss-xiaoan.oss-cn-shenzhen.aliyuncs.com/
 
+swagger.package=com.gis.web.controller
+swagger.title=VR720-fcb sit
+swagger.description==VR720-fcb sit
+swagger.version=1.0
+
 
 #log
 logging.path=/home/data/${project.name}_log

+ 5 - 0
cms_pano_fcb/gis_application/src/main/resources/application-test.properties

@@ -90,6 +90,11 @@ oss.file.path=${project.name}/
 #oss.domain=http://ossxiaoan.4dage.com/
 oss.domain=https://oss-xiaoan.oss-cn-shenzhen.aliyuncs.com/
 
+swagger.package=com.gis.web.controller
+swagger.title=VR720¡ªfcb test
+swagger.description=VR720¡ªfcb test
+swagger.version=1.0
+
 
 #log
 logging.path=/home/data/${project.name}_log

+ 6 - 0
cms_pano_fcb/gis_application/src/main/resources/application-uat.properties

@@ -71,6 +71,12 @@ oss.file.path=${project.name}/
 oss.domain=https://vr-web02-uat.fcb.com.cn/
 
 
+swagger.package=com.gis.web.controller
+swagger.title=VR720-fcb uat
+swagger.description==VR720-fcb uat
+swagger.version=1.0
+
+
 #log
 logging.path=/home/data/${project.name}_log
 logging.config=classpath:logback-spring.xml

+ 12 - 5
cms_pano_fcb/gis_common/src/main/java/com/gis/common/config/Swagger2.java

@@ -1,7 +1,10 @@
 package com.gis.common.config;
 
+import com.gis.common.constant.ConfigConstant;
 import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import springfox.documentation.builders.ApiInfoBuilder;
@@ -30,16 +33,21 @@ import java.util.List;
  *
  * 2.9.2 不需要字启动类配置注解
  */
+@Slf4j
 @Configuration
 @EnableSwagger2
 @EnableKnife4j
 public class Swagger2 {
+
+    @Autowired
+    ConfigConstant configConstant;
+
     @Bean
     public Docket createRestApi() {
         return new Docket(DocumentationType.SWAGGER_2)
                 .apiInfo(apiInfo())
                 .select()
-                .apis(RequestHandlerSelectors.basePackage("com.gis.web.controller"))
+                .apis(RequestHandlerSelectors.basePackage(configConstant.swaggerPackage))
                 .paths(PathSelectors.any())
                 .build()
                 //添加登录认证,可以使用token
@@ -50,16 +58,15 @@ public class Swagger2 {
 
     private ApiInfo apiInfo() {
         return new ApiInfoBuilder()
-                .title("VR720 房车宝")
-                .description("VR720 房车宝 Api接口文档")
-                .version("1.0")
+                .title(configConstant.swaggerTitle)
+                .description(configConstant.swaggerDescription)
+                .version(configConstant.swaggerVersion)
                 .build();
     }
 
     private List<ApiKey> securitySchemes() {
         //设置请求头信息
         List<ApiKey> result = new ArrayList<>();
-//        ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
         ApiKey apiKey = new ApiKey("Authorization", "token", "header");
         result.add(apiKey);
         return result;

+ 12 - 0
cms_pano_fcb/gis_common/src/main/java/com/gis/common/constant/ConfigConstant.java

@@ -43,6 +43,18 @@ public class ConfigConstant {
     @Value("${oss.domain}")
     public  String ossDomain;
 
+    @Value("${swagger.package}")
+    public  String swaggerPackage;
+
+    @Value("${swagger.title}")
+    public  String swaggerTitle;
+
+    @Value("${swagger.description}")
+    public  String swaggerDescription;
+
+    @Value("${swagger.version}")
+    public  String swaggerVersion;
+