Spring boot 3 - OpenApi Documentation | Swagger UI
ฝัง
- เผยแพร่เมื่อ 1 มิ.ย. 2024
- #SpringBoot3 #OpenAPI3 #SwaggerUI #RESTAPI #JWTSecurity
In this comprehensive video tutorial, we will explore how to seamlessly integrate OpenAPI 3 and Swagger UI with a Spring Boot 3 application to document a REST API. Moreover, we'll demonstrate how to add JWT (JSON Web Token) security support for the API documentation, ensuring a secure and robust API.
🎁 Spring Data JPA course: aliboucoding.com/p/the-full-g...
🎁 🚀 COUPON Code: EARLYBIRD20
Don't Forget to
===========================================
💯 Free courses here: aliboucoding.com/courses
💯 Subscribe to the youtube channel
💯 Join our Discord Community - / discord
💯 Join our Facebook Group - / 589612651142975
💯 Join our Instagram: / alibou_coding
Throughout this tutorial, you will learn:
00:00 Intro
01:24 Walking through the official documentation
03:57 Add the OpenApi dependency
06:44 Whitelist the Swagger resources
08:15 Walk through the Swagger UI interface
12:32 Add OpenApi configuration (annotations)
19:32 Add security scheme
23:25 Add security requirements
27:26 Customise endpoints
32:15 Hide endpoints
34:33 Outro
By the end of this tutorial, you'll have a solid understanding of how to use OpenAPI 3 and Swagger UI to create well-documented and secure REST APIs. This knowledge will help you build more professional and user-friendly APIs, boosting the overall quality and maintainability of your projects.
Don't forget to like, comment, and subscribe for more tutorials on Spring Boot, OpenAPI, and other web development topics. If you have any questions or suggestions, feel free to leave a comment below.
Join the Micro Services course waiting list and get and get an exclusive *EARLY-BIRD discount*
aliboucoding.ck.page/d0f9317e13
This is a great swagger tutorial!
I loved it!
Thank you Alibou for the awesome content!
Really happy you liked it
Such a goldmine channel! So glad I stumbled to your channel! Keep the knowledge flowing brother!
My pleasure!
Happy to have you within the family
Thanks a lot! I've seen a lot of tutorials and yours is the best ! Everything worked at the first attempt
My pleasure!
One of the few creators who posts videos on Spring Boot, thanks a lot!!
Happy you liked it!
Thank you for the best Spring Security content at the moment! Please continue to delight us with new videos!
I would like to see something about JUnit. 🥺
Thank you for the nice feedback.
I will prepare a video for Unit testing (soon)
Salam,
Wonderful content Ali. You are such an amazing mentor. Love to see more coming.
That was so useful, and u have an amazing way of explaining things, thank you!
Glad it was helpful!
As always very detailed and awesome video. Subscribed!
Thanks and welcome
Wollah to me you are the best content creator in the entire TH-cam Ali 🥰
Thank you so so much Alibou. May Allah reward you abundantly.
this comment really made my day.
I will never stop creating content especially for nice people like you.
God bless you
Amazing tutorial mate!
It was one of the best tutorials in Swagger and I appreciated your efforts 🥰👍👍👍
Thank you so much 😀
Your presentation is really awesome.
Happy you liked it
amazing tutorial thanks buddy you solved the issue i was looking for very clear concise
Glad it helped
thanks a lot Ali, it was very helpful !
Glad to hear that!
Great tutorial. Thank you!
Glad you think so!
Your videos are amazing and very very easy to understand, regardless if the topic is complex or not. What would I like to see is a tutorial for INTEGRATION tests, but not the integration tests of controllers which are methods that add two numbers but something more complex. Keep up the great work and thanks for all you do!
Great suggestion!
What about integration tests with postman collections and newman to run them independently?
@@BoualiAli I think that would be great as a follow up, to the topic i suggested in the first place. Make a series of it or something maybe 😁
Thanks for the reply!
@@fearlessflow3308 i will make a serie for testing covering all test phases
@@BoualiAli Thank you so much. I am looking forward to watching it!
Very informative & complete video on swagger ui .. Thanks for this awesome videos 🔥🔥
Really happy you enjoyed it
Thanx bro for your amazing videos, You were a big help to me as I was scratching my head in swagger-ui-2 , gettting muddled over annd over again.
Happy to help!
Great content, thank you man ❤
my pleasure. Happy you liked it
@@BoualiAli can we protect the api docs with basic auth for additional security?
Video was super helpful, thumbs up my friend!
Glad it was helpful!
Great content, thank you 🤩
my pleasure. Happy you liked it
Very good video my friend! Thank you very much!
Thank you! Cheers!
Thank you for the great video!
Glad you liked it!
thanks bro, high quality!
Happy you liked it!
You're just amazing!
great video ! clear explanation , thanks like it
Glad you liked it!
Awesome video.. informative 👍
Happy you liked it
Thank you so much bro for this super video 😊😊
Really happy to help.
Great tutorial, thank you very much
Happy you liked it!
Golden content, thanks!
Happy you liked it!
Nice stuffs ❤
Keep going man
thanks. Happy you liked it
thanks for this amazing tutorial 🙏🙏🙏
Glad it was helpful!
Alhamdulillah, been waiting for this
Always happy to help
Very useful details.
Glad you liked it
you are saving lives , really thanks
Glad you liked it!
Thank you man good work
Happy you liked it
very interesting, thank you for this video
my pleasire
just that i need it, great video new suscriber
Thanks for the sub!
Amazing video..thanks a lot.
Glad you liked it!
very intuitive❤...
thanks
best spring boot teacher ever
Really happy you liked it
Quel monstre, merci !
Thank you
I am became your fan now.🙌
Welcome to the family
trop fort le mec, thank you
Welcome!
Beautiful
Very Helpful
Glad you liked it!
Thank you!
welcome
ohh thanks so much. This is now working...
Enjoy
Thanks Bouali ❤❤
Happy you liked it!
Thank you 😊
Happy you liked it!
great !
🥰 Very happy thanks you sir
my pleasure
This is gold
Happy you liked it!
Merci beaucoup 🎉
Really happy you liked it
I don't speak English, but I understood everything, Gracias!
Glad I could help!
Amazing content please keep going and please try to mention all things that sould not be in production
Sure I will
@@BoualiAli Thank you so much
Thank you so much....
my pleasure
you are amazing..
Thank you so much 😀
Hi Ali, how can we provide desired custom example value to the endpoints which we want as a reference to the user about what to expect ? Your videos are great btw.
Here is an example for that
@GetMapping("/yourEndpoint")
@ApiOperation(value = "Your endpoint operation", notes = "Additional notes about the endpoint")
public ResponseEntity yourEndpoint(
@ApiParam(value = "Example value for parameter", example = "exampleValue") @RequestParam String parameter) {
// Your implementation here
return ResponseEntity.ok("Response");
}
Thank you for this video it was really helpful. I have one question though how do I make it work for functional endpoints because I tried using the examples in the documentation
Can you please explain a bit more?
Thank you
my pleasure
thank you for the video! is there a way you could make a tutorial on java based approach instead of this annotation approach? i prefer the former as i can inject values from property files into the swagger config
Great suggestion!
Can you make a small video on explaining about the Schemas in Swagger UI and how to make changes to it.
Can you please tell me more?
Thanks for the video.
I implemented it in my project.
I want swagger to not make real calls to the database in the prod environment(it's fine in other environments), but simultaneously, I want to have real calls to the database in prod if, for example, I hit the endpoint with Postman.
Is there a way to achieve this?
Swagger is not responsible for making calls to the database. It acts exactly like postman.
Also it is not always recommended to expose the swagger for prod. Pre-prod or dev environment are enough
We need more spring boot 3 tutorials like this.
Thanks.
Please let me know what you want to see next
@@BoualiAli microservice
@@anjanx44 already published
Thanks
Thank you and I really appreciate your support
Its an excellent video on openapi. but i have a problem in my application like
In my RESTController. i have 4 end points and. i need to pass JWT token only for 2 endpoints as part of request header. How can i achive this pls ?
Hi BoualiAli, I have a question, if I have an architecture in which I have configured, spring config server, spring eureka, spring api-gateway, spring security for auth with jwt, and I have several microservices that are within this architecture, how or where they should configure swagger so that it recognizes all the documentation of all spring boot microservices?
In the api gw
Hi Ali! I see some projects which use OpenApi auto generate Controller included Swagger Documentation just by define information in api.yml file. So, I'm very confused with it.
Do you think this is the good way? And do you know what way people use to document API nowadays?
Sorry for my bad English!
No worries your english is good.
I get your answer and this was a topic for a long discussion with some experienced developers / architects.
I will make a video soon explaining this topic and its advantages and disadvantages
Thanks for the video. Can I somehow download the specification, for example, when executing the gradle task?
Yes you can!
You can use the openApi plugin to generate and download the specification
@@BoualiAli Thanks. I have done it. Is it possible also to download somehow the swagger-ui.html?
Thank you so much. It would be more helpful if you bring spring boot projects
Sure thing!
@@BoualiAli thank you
Thank you sir for this awesome tutorial, please how do I go deploy the swagger file?
where to deploy it?
Hello Ali, can you create a video on Angular e-commence full stack application.
Already working on it
first thanks for this wonderful tutorial 😀
I had a small issue in using magement APIS. i get 403 with this test when debug Responding with 403 status code
Securing GET /error
Set SecurityContextHolder to anonymous SecurityContext
Pre-authenticated entry point called. Rejecting access
also this only happen with this controller others work perfect and my user is admin also i check the code from repo and i cant find anything.
Could you also cover @ApiResponses and @Pattern and validations of request body?
You can check the documentation for that
Hi bro,
can u please provide a tutorial on Apache Camel Integration Framework.
for eg: (rest.xml and route.xml)
What is your intellij theme by the way? I really like it
Thanks, this is the new theme from the newest version of Intellij
Can you share some insight into how we can inject some custom CSS in swagger ui ?
I never tried that.
But, why do you need that?
Hi Ali,
how can i hide the '/v3/api-docs/ Explore' section and the 'Servers' section on Swagger UI?
I never tried that.
Let me check and come back to you
Like you said, how to generate automatic openapi docs to angular? Still pleasure of watching your content
Coming soon
I'm also interested please
How do I get that URL link (server / UAT) from application.properties file for open API annotation. @value is showing error
In my swagger openapi v3 the order for endpoints is very different from yours.
It shows PUT-Requests first, then DELETE and then GET.
How do I get the order GET, POST, PUT, DELETE?
Some say it's naming order is asc, but in your example m(anagement) comes before a(dmin) eventhough in alphabet a comes before m
Check the documentation for ordering the endpoints
I still get cannot load API definition even though I did permitAll() on all those URLs.
beautiful pom.xml file which theme do you use?
Default theme from the new version of intellij
In a post method, is it normal for the swagger to see empty parameters if I specify that it has a @RequestBody?
Nope, it should not
I do not see my token in my RUN, how i can do this? i used token in register place, but i am also get the error 403...
Hi ali , thanks for this session .if our code is deployed on cloud like azure how can i acess tge swagger through actual ip or actual url rather than localhost can u help me on that
You can
@@BoualiAli can you guide me or help me on that how to acces th swagger ui after deployment .is there any existing video available or any article.please help.
Can all of this work with Spring Webflux? I like your videos.
I need to check it first. I never tried that
Do you have udemy courses for spring boot or docker/kubernetes?
yes, check aliboucoding.com/courses
Sir can you help us for free internship. Where to find and how to apply in spring boot and microservices with spring cloud and spring related.
Follow me on social media. if I have something I will share it there
Please help me.İ get no operation defined in spec in swagger when add this dependency but server is correct
Can you show more details?
Post on discord server with screenshots
Does this work with Gradle? I cant find an Implementation to get Swagger UI running.
yes it does
Can you make one on how to set OAuth2
Already done. Check the playlists
Can we create custom @ApiResponse for example @OkApiResponse (with 200 and OK)?? If yes how?
yes you can,
Just create an annotation and add @ApiResponse with status 200 on top of it
Where is the video about permissions, roles, authorizations? i can't find it
In the playlist
How does this openApiconfig are detected by springboot. We didnot create any bean right
it is a starter, so it is automatically detected
how to make output colorful like you
Hello sir when I documents a multipart api this open ui not showing browse button how can I get
the endpoint should consume "multipart/form-data"
Which is your intelij Theme?
The default theme from the latest version