fanxw 1 рік тому
батько
коміт
428435ac6f

+ 2 - 0
src/main/java/com/chinaitop/depot/SwaggerConfig.java

@@ -1,6 +1,7 @@
1
 package com.chinaitop.depot;
1
 package com.chinaitop.depot;
2
 
2
 
3
 import org.springframework.beans.factory.annotation.Value;
3
 import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4
 import org.springframework.context.annotation.Bean;
5
 import org.springframework.context.annotation.Bean;
5
 import org.springframework.context.annotation.Configuration;
6
 import org.springframework.context.annotation.Configuration;
6
 
7
 
@@ -14,6 +15,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
14
 
15
 
15
 @Configuration
16
 @Configuration
16
 @EnableSwagger2
17
 @EnableSwagger2
18
+@ConditionalOnProperty(name = "swagger.enable", havingValue = "true")
17
 public class SwaggerConfig {
19
 public class SwaggerConfig {
18
 
20
 
19
 	@Value("${eureka.instance.hostname}")
21
 	@Value("${eureka.instance.hostname}")

+ 4 - 0
src/main/resources/bootstrap.yml

@@ -7,6 +7,10 @@ management:
7
   server:
7
   server:
8
     port: -1
8
     port: -1
9
 
9
 
10
+#是否开启swaggeer? true开启,false关闭,生产环境要求关闭
11
+swagger:
12
+  enable: true
13
+
10
 # 注册中心配置
14
 # 注册中心配置
11
 eureka:
15
 eureka:
12
   client:
16
   client: