Spring boot 3 - OpenApi Documentation | Swagger UI
Вставка
- Опубліковано 22 лип 2024
- Buy me a coffee: ko-fi.com/boualiali #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
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
This is a great swagger tutorial!
I loved it!
Thank you Alibou for the awesome content!
Really happy you liked it
One of the few creators who posts videos on Spring Boot, thanks a lot!!
Happy you liked it!
Salam,
Wonderful content Ali. You are such an amazing mentor. Love to see more coming.
Thanks a lot! I've seen a lot of tutorials and yours is the best ! Everything worked at the first attempt
My pleasure!
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)
Wollah to me you are the best content creator in the entire UA-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
Thank you for sharing, it was fast and clear, very intuitive
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!
It was one of the best tutorials in Swagger and I appreciated your efforts 🥰👍👍👍
Thank you so much 😀
That was so useful, and u have an amazing way of explaining things, thank you!
Glad it was helpful!
Very informative & complete video on swagger ui .. Thanks for this awesome videos 🔥🔥
Really happy you enjoyed it
Video was super helpful, thumbs up my friend!
Glad it was helpful!
As always very detailed and awesome video. Subscribed!
Thanks and welcome
amazing tutorial thanks buddy you solved the issue i was looking for very clear concise
Glad it helped
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 good video my friend! Thank you very much!
Thank you! Cheers!
Amazing tutorial mate!
Best channel ever
Thanks bro, it helped
Thank you so much bro for this super video 😊😊
Really happy to help.
You're just amazing!
Awesome video.. informative 👍
Happy you liked it
Alhamdulillah, been waiting for this
Always happy to help
Your presentation is really awesome.
Happy you liked it
Great tutorial. Thank you!
Glad you think so!
thanks a lot Ali, it was very helpful !
Glad to hear that!
Thank you for the great video!
Glad you liked it!
Great content, thank you 🤩
my pleasure. Happy you liked it
great video ! clear explanation , thanks like it
Glad you liked it!
thanks bro, high quality!
Happy you liked it!
Very useful details.
Glad you liked it
Nice stuffs ❤
Keep going man
thanks. Happy you liked it
Golden content, thanks!
Happy you liked it!
Bravo 🎉 merci 🙏
Great tutorial, thank you very much
Happy you liked it!
best spring boot teacher ever
Really happy you liked it
just that i need it, great video new suscriber
Thanks for the sub!
very interesting, thank you for this video
my pleasire
you are saving lives , really thanks
Glad you liked it!
Great content, thank you man ❤
my pleasure. Happy you liked it
@@BoualiAli can we protect the api docs with basic auth for additional security?
Quel monstre, merci !
Thank you
Thank you man good work
Happy you liked it
thanks for this amazing tutorial 🙏🙏🙏
Glad it was helpful!
Amazing video..thanks a lot.
Glad you liked it!
I am became your fan now.🙌
Welcome to the family
trop fort le mec, thank you
Welcome!
ohh thanks so much. This is now working...
Enjoy
Beautiful
great !
thank you
I don't speak English, but I understood everything, Gracias!
Glad I could help!
Very Helpful
Glad you liked it!
Thanks Bouali ❤❤
Happy you liked it!
very intuitive❤...
thanks
I still get cannot load API definition even though I did permitAll() on all those URLs.
How do I get that URL link (server / UAT) from application.properties file for open API annotation. @value is showing error
Thank you!
welcome
What if I want to change the title of a web page in the window? (Swagge UI
)
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...
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.
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 bro,
can u please provide a tutorial on Apache Camel Integration Framework.
for eg: (rest.xml and route.xml)
This is gold
Happy you liked it!
Thank you 😊
Happy you liked it!
🥰 Very happy thanks you sir
my pleasure
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
Merci beaucoup 🎉
Really happy you liked it
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 so much....
my pleasure
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
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");
}
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
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
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
Thank you and I really appreciate your support
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
Thank you
my pleasure
Could you also cover @ApiResponses and @Pattern and validations of request body?
You can check the documentation for that
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
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!
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
so slow and crashing with spring boot 3. also Init duration for springdoc-openapi is: 42494 ms
Thank you so much. It would be more helpful if you bring spring boot projects
Sure thing!
@@BoualiAli thank you
Hello Ali, can you create a video on Angular e-commence full stack application.
Already working on it
how to make output colorful like you
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 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?
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
@Operation too cumbersome, makes it difficult to read the code
Thank you sir for this awesome tutorial, please how do I go deploy the swagger file?
where to deploy it?
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?
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"
What is your intellij theme by the way? I really like it
Thanks, this is the new theme from the newest version of Intellij
How does this openApiconfig are detected by springboot. We didnot create any bean right
it is a starter, so it is automatically detected
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.
Where is the video about permissions, roles, authorizations? i can't find it
In the playlist