【问题标题】:How to disable swagger 3 configuration in spring boot如何在 Spring Boot 中禁用 swagger 3 配置
【发布时间】:2019-10-01 10:47:12
【问题描述】:

我需要在我的 Spring Boot API 中支持 swagger 2 和 3。

我使用 docket 对象创建了 swagger 2,并且为 swagger 3 添加了 maven 依赖项 springdoc-openapi-ui。能够检查 swagger 2 和 3 文档。

如何仅禁用/启用 swagger 3 或 swagger 2?我的意思是如何禁用 swagger 3 配置?

我没有使用 @profile 启用/禁用 swagger 3 配置类。只需添加 springdoc-openapi-ui maven 依赖 swagger 3 即可。

【问题讨论】:

    标签: swagger swagger-ui swagger-2.0 swagger-3.0


    【解决方案1】:

    这是从comment复制的答案

    以下属性自以下版本可用:v1.1.16

    springdoc.api-docs.enabled=false 此属性可帮助您禁用 springdoc-openapi 端点。

    如果您想公开 api-docs 端点而不使用 swagger-ui,可以使用核心依赖:

    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-core</artifactId>
        <version>1.1.16</version>
    </dependency>

    【讨论】:

      猜你喜欢
      • 2018-11-29
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      • 2022-01-21
      • 2015-04-29
      • 2022-12-23
      • 2020-07-11
      • 2023-02-23
      相关资源
      最近更新 更多