|
@@ -3,6 +3,7 @@ package com.ruoyi.framework.config; |
|
@@ -3,6 +3,7 @@ package com.ruoyi.framework.config; |
|
3
|
import java.util.ArrayList;
|
3
|
import java.util.ArrayList;
|
|
4
|
import java.util.List;
|
4
|
import java.util.List;
|
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
6
|
+import org.springframework.beans.factory.annotation.Value;
|
|
6
|
import org.springframework.context.annotation.Bean;
|
7
|
import org.springframework.context.annotation.Bean;
|
|
7
|
import org.springframework.context.annotation.Configuration;
|
8
|
import org.springframework.context.annotation.Configuration;
|
|
8
|
import io.swagger.annotations.ApiOperation;
|
9
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -32,6 +33,10 @@ public class SwaggerConfig |
|
@@ -32,6 +33,10 @@ public class SwaggerConfig |
|
32
|
@Autowired
|
33
|
@Autowired
|
|
33
|
private RuoYiConfig ruoyiConfig;
|
34
|
private RuoYiConfig ruoyiConfig;
|
|
34
|
|
35
|
|
|
|
|
36
|
+ /** Swagger开关配置 */
|
|
|
|
37
|
+ @Value("${swagger.enable}")
|
|
|
|
38
|
+ private boolean swaggerEnable;
|
|
|
|
39
|
+
|
|
35
|
/**
|
40
|
/**
|
|
36
|
* 创建API
|
41
|
* 创建API
|
|
37
|
*/
|
42
|
*/
|
|
@@ -39,6 +44,8 @@ public class SwaggerConfig |
|
@@ -39,6 +44,8 @@ public class SwaggerConfig |
|
39
|
public Docket createRestApi()
|
44
|
public Docket createRestApi()
|
|
40
|
{
|
45
|
{
|
|
41
|
return new Docket(DocumentationType.SWAGGER_2)
|
46
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
|
|
47
|
+ // 是否启用Swagger
|
|
|
|
48
|
+ .enable(swaggerEnable)
|
|
42
|
.pathMapping("/dev-api")
|
49
|
.pathMapping("/dev-api")
|
|
43
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
50
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
|
44
|
.apiInfo(apiInfo())
|
51
|
.apiInfo(apiInfo())
|