How do you turn off swagger-ui in production

前端 未结 6 1613
孤独总比滥情好
孤独总比滥情好 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

    1. have configuration for env

      @Configuration

      @EnableSwagger2

      @Profile("devone")

    2. application.yaml

      profiles: 
      
      active:
      
       ${MY_ENV:devone}
      

    MY_ENV you will read from file, like .env

    .env file content: MY_ENV=prod

    In the production keep other .env file only for production credentials.

提交回复
热议问题