mirror of
https://gitee.com/dromara/dbswitch.git
synced 2026-09-03 05:14:32 +08:00
fix:配置swagger是否开启
This commit is contained in:
@@ -13,6 +13,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@@ -30,6 +32,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Value("${swagger.enable}")
|
||||
private boolean isEnableSwagger;
|
||||
|
||||
public static final String API_PREFIX = "/dbswitch/admin/api";
|
||||
public static final String API_V1 = API_PREFIX + "/v1";
|
||||
private static final String API_DEFAULT_PACKAGE = "org.dromara.dbswitch.admin.controller.privateapi";
|
||||
@@ -55,6 +60,7 @@ public class SwaggerConfig {
|
||||
pars.add(ticketPar.build());
|
||||
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(isEnableSwagger)
|
||||
.groupName("需要认证的接口")
|
||||
.apiInfo(createApiInfo())
|
||||
.select()
|
||||
@@ -68,6 +74,7 @@ public class SwaggerConfig {
|
||||
@Bean(value = "publicApi")
|
||||
public Docket publicApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(isEnableSwagger)
|
||||
.groupName("无需认证的接口")
|
||||
.apiInfo(createApiInfo())
|
||||
.select()
|
||||
|
||||
@@ -25,3 +25,19 @@ mybatis:
|
||||
dbswitch:
|
||||
configuration:
|
||||
drivers-base-path: ${APP_DRIVERS_PATH}
|
||||
|
||||
# Swagger 两种方式都可以关闭
|
||||
swagger:
|
||||
enable: false
|
||||
|
||||
springfox:
|
||||
documentation:
|
||||
# 关键:全局禁用开关
|
||||
enabled: false
|
||||
swagger-ui:
|
||||
enabled: false
|
||||
swagger:
|
||||
enabled: false
|
||||
v2:
|
||||
enabled: false
|
||||
auto-startup: false
|
||||
Reference in New Issue
Block a user