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
- Pinco casino: Selection Checklist for casino
- Explore safe payment methods for online casino withdrawals in 2026
- Dive into online gaming at MAHA168 Casino: a comprehensive look at bingo and slot
- Fordel dine kort Større chancer for sejr og en fantastisk Verde casino bonus venter.
- Få pulsen op og vind stort – din guide til underholdning og bonusser hos Verde casino.
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
- aks 1 en
- aks 18
- aks 28
- aks 31
- Angular
- AWS
- Backend Development
- Big Data
- Blog
- Cloud
- crypto 01
- crypto 05
- crypto 15
- crypto 20
- crypto 20.05
- crypto 21.05
- crypto 29
- crypto 5
- 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
- public
- Python
- Python Flask
- Report
- Security
- Server
- SpringBoot
- Subdomain
- sushicasino 13
- TypeScript
- Uncategorized
- VSCode
- Webhosting
- WordPress
- Στοιχηματικές
Search
Recent Post
Pinco casino: Selection Checklist for casino
- 24 June, 2026
- 1 min read
Explore safe payment methods for online casino
- 23 June, 2026
- 4 min read
Dive into online gaming at MAHA168 Casino:
- 23 June, 2026
- 5 min read