fanxw 1 rok temu
rodzic
commit
17f4882be7

+ 3 - 1
src/main/java/com/SwaggerConfig.java

@@ -1,6 +1,7 @@
1 1
 package com;
2 2
 
3 3
 import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4 5
 import org.springframework.context.annotation.Bean;
5 6
 import org.springframework.context.annotation.Configuration;
6 7
 
@@ -14,6 +15,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
14 15
 
15 16
 @Configuration
16 17
 @EnableSwagger2
18
+@ConditionalOnProperty(name = "swagger.enable", havingValue = "true")
17 19
 public class SwaggerConfig {
18 20
 
19 21
 	@Value("${eureka.instance.hostname}")
@@ -33,7 +35,7 @@ public class SwaggerConfig {
33 35
         return new ApiInfoBuilder()
34 36
                 .title("智能粮库管理平台api文档")
35 37
                 .description("智能仓库")
36
-                .termsOfServiceUrl("http://localhost:9001")
38
+                .termsOfServiceUrl(url)
37 39
                 .version("1.0")
38 40
                 .build();
39 41
     }

+ 5 - 1
src/main/resources/bootstrap.yml

@@ -36,6 +36,10 @@ management:
36 36
   server:
37 37
     port: -1
38 38
 
39
+#是否开启swaggeer? true开启,false关闭,生产环境要求关闭
40
+swagger:
41
+  enable: true
42
+
39 43
 spring:
40 44
   application:
41 45
     name: depot-intelligent
@@ -73,4 +77,4 @@ spring:
73 77
     serialization:
74 78
       FAIL_ON_EMPTY_BEANS: false
75 79
 web:
76
-  upload-path: /home/depot/depot-web/apache-tomcat-8.0.53/webapps/ROOT/WEB-INF/classes/static
80
+  upload-path: /home/depot/depot-web/depot-file