Search code examples
spring-bootintellij-ideaswagger-ui

How to open automatically the Swagger page of a Spring Boot app when running from Intellij?


In my Spring Boot application, I have a Swagger page.

I would like that after I launch the application from IntelliJ, it will also automatically run the browser and open the Swagger page.

Can it be done?


Solution

  • If you are hosting your swagger file using something like springdoc, or you have a static html swagger, you can add a before launch task to your project configuration.

    Go to the current project configuration:

    enter image description here

    enter image description here

    Got to modify options enter image description here

    Check Add before launch task

    enter image description here

    Then Add a task to run browser, where you can add a html file or an url.