2

I saw a similar answer for Swagger 2.x here - How do you turn off swagger-ui in production so I was wondering if there is something similar I could do for open API as well? I tried something like :

@Configuration
@Profile("!prod")
public class OpenAPIConfig 
{
}

but this doesn't work. Any thoughts/suggestions?

linuxNoob
  • 600
  • 2
  • 14
  • 30

2 Answers2

8

May be you can set the below property in prod yaml,

springdoc.api-docs.enabled=false
Nagarjuna Adapa
  • 141
  • 1
  • 6
3

Following properties can be used based on active profile

# To disable UI
springdoc.swagger-ui.enabled=false

# To disable API
springdoc.api-docs.enabled=false
Adriaan
  • 17,741
  • 7
  • 42
  • 75