Disable Swagger UI in production environment.

1,128 views
Skip to first unread message

Abhinandan

unread,
Aug 2, 2017, 5:39:57 AM8/2/17
to Swagger
Hi All,

May be this is old question but I though I can get better answer here!

We have  Swagger UI integrated with Spring Boot. I wondered when I had a though, in production using swagger UI any one can use our API's which will cause huge concerns in a business context.

I need expert advice to disable swagger UI in production environment of any environment other than development.

Below is the technical details we are following:

We have registered JerseyJaxrsConfig in web.xml as follows.

Configuration in web.xml:

<servlet>
        <servlet-name>Jersey2Config</servlet-name>
        <servlet-class>io.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
        <init-param>
            <param-name>api.version</param-name>
            <param-value>1.0.0</param-value>
        </init-param>
        <init-param>
            <param-name>swagger.api.basepath</param-name>
            <param-value>/cardmgmt/apis/v1/services/</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

Static contents available in WebContent:

swagger-ui.js
swagger-ui-min.js


Please help me to know how to disable the swagger UI with the approach we are using.

Thanks,

Abhinandan


Reply all
Reply to author
Forward
0 new messages