Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable swagger 3 configuration in spring boot

I have a requirement to support swagger 2 & 3 in my spring boot API.

I have created swagger 2 using docket object & for swagger 3 just added maven dependency springdoc-openapi-ui. Able to check swagger 2 & 3 documentation.

how do I disable/enable only swagger 3 or swagger 2? I mean how do I disable swagger 3 configurations?

I don't have swagger 3 configuration class to enable/disable by using @profile. Just adding springdoc-openapi-ui maven dependency swagger 3 worked.

like image 425
Ashwin Patil Avatar asked Sep 05 '25 03:09

Ashwin Patil


1 Answers

Here's the answer copied from this comment

The following property is available since: v1.1.16

springdoc.api-docs.enabled=false This property helps you disable springdoc-openapi endpoints.

If you want to expose the api-docs endpoints without using the swagger-ui, you can use the core dependency:

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-core</artifactId>
    <version>1.1.16</version>
</dependency>
like image 138
dk7 Avatar answered Sep 09 '25 12:09

dk7