I am trying to manually disable swagger, based on a flag in my application-local.properties. The code to disable is:
@Bean
Docket localApi() {
return new Docket(DocumentationType.SWAGGER_2)
.enable(swaggerEnabled)
.ignoredParameterTypes(MetaClass.class, MetaMethod.class)
.apiInfo(metaData())
.select()
.build()
}
swaggerEnabled is the boolean flag. This does disable the UI if the flag is false. However, when I go to http://localhost:8080/swagger-ui.html, the default message is displayed:
Could not render e, see the console.
Is there any way to change that default message when the ui is disabled?
swaggerVersion = 2.9.2
springBootVersion = 2.1.3.RELEASE
springVersion = 5.0.7.RELEASE
Thanks in advance!