In this article we are going to see how simple and fast it is to add swagger UI in SpringBoot project.
What is Swagger?
As per Google: “Swagger is an Interface Description Language for describing RESTful APIs expressed using JSON. Swagger is used together with a set of open-source software tools to design, build, document, and use RESTful web services. Swagger includes automated documentation, code generation (into many programming languages), and test-case generation.”
Prerequisites
- Must have a basic SpringBoot project up and running. (Click here to see how)
Table of Content
- Adding Swagger Dependencies
- Enabling Swagger in your SpringBoot Project
STEP 1: Adding Swagger Dependencies
In the first place, to integrate swagger to your SpringBoot project, you need to add the following dependencies in the POM.xml file of your project.
STEP 2: Enable Swagger in your SpringBoot Project
After adding all the dependencies, we now need to add an annotation to add swagger UI in the SpringBoot project. Simply open up your entry point java class and add this annotation at the top: “@EnableSwagger2”.
Next, you need to add a Bean instance inside the same class where you added the above annotation. Therefore, copy the following code in your main java application entry class.
Take reference from the image shown below.
In the code that you will add, it asks for a ‘base package’. This is going to be the package name that is mentioned at the very top of the same java class. It’s also highlighted with a red box in the above image as well. This bean instance basically tells the swagger to find all the available API endpoints in all your controller classes of your project. And then it will be displayed to the user on the browser at a specific URL. This project is running on port 8080, so the URL is going to be http://localhost:8080/swagger-ui.html
Finally, run the project and go the above-mentioned URL and you will be displayed with the Swagger UI like so:
And we are done!
Hope this helps you to understand how exactly to add Swagger UI in the SpringBoot project. If you have any questions, please leave a comment down below and share this article with others too.
Have a great one!
Recent Posts
- Fragilité et enchantement du jeu avec lolly bet pour une expérience singulière
- Optimizing_your_order_execution_speed_by_migrating_to_a_high-liquidity_professional_trading_site_onl
- What Players Notice First at a Fast Withdrawal Casino and Why It Matters
- Desarrollo y maestría en el juego king maker, una escuela de habilidades estratégicas
- Impacto y relevancia de betsson en el panorama del juego online
Recent Comments
Archives
- June 2026
- May 2026
- October 2025
- October 2024
- September 2024
- August 2024
- June 2024
- January 2024
- November 2023
- October 2023
- September 2023
- August 2023
- June 2023
- May 2023
- March 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
Categories
- 21
- Angular
- AWS
- Backend Development
- Big Data
- Blog
- Cloud
- crypto 20
- crypto 20.05
- crypto 21.05
- crypto 29
- Database
- Deployment
- DevOps
- Docker
- fi
- Frontend Development
- GitHub
- Google Cloud Platform
- hu
- Installations
- it
- Java
- JavaScript
- Linux
- MySQL
- Networking
- News
- nl
- no
- NodeJS
- Online casino
- Operating System
- Post
- Python
- Python Flask
- Report
- Security
- Server
- SpringBoot
- Subdomain
- TypeScript
- Uncategorized
- VSCode
- Webhosting
- WordPress
Search
Recent Post
Fragilité et enchantement du jeu avec lolly
- 9 June, 2026
- 8 min read
What Players Notice First at a Fast
- 9 June, 2026
- 4 min read