spring doc:支持通过 springdoc.api-docs 禁用

This commit is contained in:
YunaiV 2023-01-19 15:15:40 +08:00
parent 711a39b8e9
commit d193d2dd4a
2 changed files with 5 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
import org.springdoc.core.providers.JavadocProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpHeaders;
@ -39,6 +40,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
@AutoConfiguration
@ConditionalOnClass({OpenAPI.class})
@EnableConfigurationProperties(SwaggerProperties.class)
@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true) // 设置为 false 禁用
public class YudaoSwaggerAutoConfiguration {
// ========== 全局 OpenAPI 配置 ==========

View File

@ -37,12 +37,12 @@ spring:
--- #################### 接口文档配置 ####################
springdoc:
swagger-ui:
enabled: true
path: /swagger-ui
api-docs:
enabled: true
path: /v3/api-docs
swagger-ui:
enabled: true
path: /swagger-ui
knife4j:
enable: true