How do you turn off swagger-ui in production

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

    For those that use code gen (which generates Swagger2SpringBoot):

    1. Write your own Swagger2SpringBoot (with the @Profile bit) and locate it in the same package path as the autogenerated one.
    2. Edit swagger-codegen-maven-plugin to place generated into src/main/java (which will overwrite your own one in point 1.
    3. Edit .swagger-codegen-ignore to not overwrite your Swagger2SpringBoot
    4. Note other stuff will also be overwritten eg. pom.xml and application.properties. Just add them to .swagger-codegen-ignore too.

    Done.

提交回复
热议问题