How do you turn off swagger-ui in production

前端 未结 6 1788
孤独总比滥情好
孤独总比滥情好 2021-01-31 14:46

I have swagger plugged in to my spring boot application. Spring boot allows you to have property files for each environment that you have. Is there a way to disable swagger fo

6条回答
  •  天命终不由人
    2021-01-31 15:07

    spring.profiles.active=production with @Profile("!production") worked for me to turn off swagger in prod.

    Ex :-

    @Profile("!production")
    @Component
    @EnableSwagger2
    public class SwaggerConfig {
           //TODO
    }
    

提交回复
热议问题