Commit 94ef0d856feb1802a9a672ee079308497578ae6b

Authored by 648540858
1 parent 96bc081e

修复关闭接口文档失效

... ... @@ -253,6 +253,9 @@
253 253 <plugin>
254 254 <groupId>org.apache.maven.plugins</groupId>
255 255 <artifactId>maven-surefire-plugin</artifactId>
  256 + <configuration>
  257 + <skipTests>true</skipTests>
  258 + </configuration>
256 259 </plugin>
257 260  
258 261 </plugins>
... ...
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
1 1 package com.genersoft.iot.vmp.conf;
2 2  
  3 +import org.springframework.beans.factory.annotation.Value;
3 4 import org.springframework.context.annotation.Bean;
4 5 import org.springframework.context.annotation.Configuration;
5 6 import springfox.documentation.builders.ApiInfoBuilder;
... ... @@ -13,49 +14,70 @@ import springfox.documentation.spring.web.plugins.Docket;
13 14 @Configuration
14 15 public class Swagger3Config {
15 16  
  17 + @Value("${swagger-ui.enabled}")
  18 + private boolean enable;
  19 +
16 20 @Bean
17 21 public Docket createRestApi() {
18 22 return new Docket(DocumentationType.OAS_30)
19 23 .apiInfo(apiInfo())
20   - .groupName("全部")
  24 + .groupName("1. 全部")
21 25 .select()
22 26 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager"))
23 27 .paths(PathSelectors.any())
24 28 .build()
25   - .pathMapping("/");
  29 + .pathMapping("/")
  30 + .enable(enable);
26 31 }
27 32 @Bean
28 33 public Docket createRestGBApi() {
29 34 return new Docket(DocumentationType.OAS_30)
30 35 .apiInfo(apiInfo())
31   - .groupName("国标")
  36 + .groupName("2. 国标28181")
32 37 .select()
33 38 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.gb28181"))
34 39 .paths(PathSelectors.any())
35 40 .build()
36   - .pathMapping("/");
  41 + .pathMapping("/")
  42 + .enable(enable);
  43 + }
  44 +
  45 + @Bean
  46 + public Docket createRestONVIFApi() {
  47 + return new Docket(DocumentationType.OAS_30)
  48 + .apiInfo(apiInfo())
  49 + .groupName("3. ONVIF")
  50 + .select()
  51 + .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.onvif"))
  52 + .paths(PathSelectors.any())
  53 + .build()
  54 + .pathMapping("/")
  55 + .enable(enable);
37 56 }
  57 +
38 58 @Bean
39 59 public Docket createRestStreamProxyApi() {
40 60 return new Docket(DocumentationType.OAS_30)
41 61 .apiInfo(apiInfo())
42   - .groupName("拉流转发")
  62 + .groupName("4. 拉流转发")
43 63 .select()
44 64 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.streamProxy"))
45 65 .paths(PathSelectors.any())
46 66 .build()
47   - .pathMapping("/");
  67 + .pathMapping("/")
  68 + .enable(enable);
48 69 }
49 70 @Bean
50 71 public Docket createRestStreamPushApi() {
51 72 return new Docket(DocumentationType.OAS_30)
52 73 .apiInfo(apiInfo())
53   - .groupName("推流管理")
  74 + .groupName("5. 推流管理")
54 75 .select()
55 76 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.streamPush"))
56 77 .paths(PathSelectors.any())
57 78 .build()
58   - .pathMapping("/");
  79 + .pathMapping("/")
  80 + .enable(enable);
59 81 }
60 82  
61 83  
... ... @@ -63,23 +85,25 @@ public class Swagger3Config {
63 85 public Docket createServerApi() {
64 86 return new Docket(DocumentationType.OAS_30)
65 87 .apiInfo(apiInfo())
66   - .groupName("服务管理")
  88 + .groupName("6. 服务管理")
67 89 .select()
68 90 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.server"))
69 91 .paths(PathSelectors.any())
70 92 .build()
71   - .pathMapping("/");
  93 + .pathMapping("/")
  94 + .enable(enable);
72 95 }
73 96 @Bean
74 97 public Docket createUserApi() {
75 98 return new Docket(DocumentationType.OAS_30)
76 99 .apiInfo(apiInfo())
77   - .groupName("用户管理")
  100 + .groupName("7. 用户管理")
78 101 .select()
79 102 .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager.user"))
80 103 .paths(PathSelectors.any())
81 104 .build()
82   - .pathMapping("/");
  105 + .pathMapping("/")
  106 + .enable(enable);
83 107 }
84 108  
85 109 private ApiInfo apiInfo() {
... ...
src/main/resources/all-application.yml
... ... @@ -152,7 +152,5 @@ user-settings:
152 152 record-push-live: true
153 153  
154 154 # 在线文档: swagger-ui(生产环境建议关闭)
155   -springfox:
156   - documentation:
157   - swagger-ui:
158   - enabled: true
159 155 \ No newline at end of file
  156 +swagger-ui:
  157 + enabled: true
160 158 \ No newline at end of file
... ...
src/main/resources/application-dev.yml
... ... @@ -84,7 +84,5 @@ user-settings:
84 84 record-push-live: true
85 85  
86 86 # 在线文档: swagger-ui(生产环境建议关闭)
87   -springfox:
88   - documentation:
89   - swagger-ui:
90   - enabled: true
91 87 \ No newline at end of file
  88 +swagger-ui:
  89 + enabled: true
92 90 \ No newline at end of file
... ...