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.

КОМЕНТАРІ • 227

  • @BoualiAli
    @BoualiAli  11 місяців тому +2

    Join the Micro Services course waiting list and get and get an exclusive *EARLY-BIRD discount*
    aliboucoding.ck.page/d0f9317e13

  • @niccubagonoc9907
    @niccubagonoc9907 10 місяців тому +1

    Such a goldmine channel! So glad I stumbled to your channel! Keep the knowledge flowing brother!

    • @BoualiAli
      @BoualiAli  10 місяців тому +2

      My pleasure!
      Happy to have you within the family

  • @ayyubxonrustamov700
    @ayyubxonrustamov700 Рік тому +7

    This is a great swagger tutorial!
    I loved it!
    Thank you Alibou for the awesome content!

  • @tanaykamath1415
    @tanaykamath1415 8 місяців тому +1

    One of the few creators who posts videos on Spring Boot, thanks a lot!!

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @mrcoder9401
    @mrcoder9401 4 місяці тому

    Salam,
    Wonderful content Ali. You are such an amazing mentor. Love to see more coming.

  • @federicovinas1486
    @federicovinas1486 10 місяців тому

    Thanks a lot! I've seen a lot of tutorials and yours is the best ! Everything worked at the first attempt

  • @llummin
    @llummin Рік тому +2

    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. 🥺

    • @BoualiAli
      @BoualiAli  Рік тому +2

      Thank you for the nice feedback.
      I will prepare a video for Unit testing (soon)

  • @abu-dukhan
    @abu-dukhan Рік тому +6

    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.

    • @BoualiAli
      @BoualiAli  Рік тому +3

      this comment really made my day.
      I will never stop creating content especially for nice people like you.
      God bless you

  • @razafiarisonmichael4421
    @razafiarisonmichael4421 3 дні тому

    Thank you for sharing, it was fast and clear, very intuitive

  • @srirampant3135
    @srirampant3135 11 місяців тому

    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.

    • @BoualiAli
      @BoualiAli  11 місяців тому +1

      Happy to help!

  • @SamanSarafraz
    @SamanSarafraz 7 місяців тому

    It was one of the best tutorials in Swagger and I appreciated your efforts 🥰👍👍👍

    • @BoualiAli
      @BoualiAli  6 місяців тому

      Thank you so much 😀

  • @oumaimabenjouida6724
    @oumaimabenjouida6724 Рік тому

    That was so useful, and u have an amazing way of explaining things, thank you!

  • @user-og7de8ih4f
    @user-og7de8ih4f Рік тому +1

    Very informative & complete video on swagger ui .. Thanks for this awesome videos 🔥🔥

    • @BoualiAli
      @BoualiAli  Рік тому +1

      Really happy you enjoyed it

  • @larcomdev
    @larcomdev 4 місяці тому

    Video was super helpful, thumbs up my friend!

    • @BoualiAli
      @BoualiAli  3 місяці тому

      Glad it was helpful!

  • @sho.sus.0023
    @sho.sus.0023 5 місяців тому

    As always very detailed and awesome video. Subscribed!

    • @BoualiAli
      @BoualiAli  2 місяці тому +1

      Thanks and welcome

  • @rakshitshetty7004
    @rakshitshetty7004 11 місяців тому

    amazing tutorial thanks buddy you solved the issue i was looking for very clear concise

  • @fearlessflow3308
    @fearlessflow3308 Рік тому +4

    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!

    • @BoualiAli
      @BoualiAli  Рік тому +3

      Great suggestion!
      What about integration tests with postman collections and newman to run them independently?

    • @fearlessflow3308
      @fearlessflow3308 Рік тому +1

      @@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!

    • @BoualiAli
      @BoualiAli  Рік тому +2

      @@fearlessflow3308 i will make a serie for testing covering all test phases

    • @fearlessflow3308
      @fearlessflow3308 Рік тому +1

      @@BoualiAli Thank you so much. I am looking forward to watching it!

  • @luishenriquedossantos8183
    @luishenriquedossantos8183 11 місяців тому

    Very good video my friend! Thank you very much!

    • @BoualiAli
      @BoualiAli  11 місяців тому

      Thank you! Cheers!

  • @LePhenixGD
    @LePhenixGD 7 місяців тому

    Amazing tutorial mate!

  • @22zain
    @22zain День тому

    Best channel ever

  • @samallangi
    @samallangi 18 днів тому

    Thanks bro, it helped

  • @temrimoose
    @temrimoose Рік тому +1

    Thank you so much bro for this super video 😊😊

  • @mostafamayou756
    @mostafamayou756 7 місяців тому

    You're just amazing!

  • @ankitasthana7822
    @ankitasthana7822 Рік тому +1

    Awesome video.. informative 👍

  • @IzharJumadi
    @IzharJumadi Рік тому +1

    Alhamdulillah, been waiting for this

  • @anjanx44
    @anjanx44 Рік тому +1

    Your presentation is really awesome.

  • @predragradojicic5829
    @predragradojicic5829 5 місяців тому

    Great tutorial. Thank you!

    • @BoualiAli
      @BoualiAli  2 місяці тому

      Glad you think so!

  • @khalilbouali3480
    @khalilbouali3480 9 місяців тому

    thanks a lot Ali, it was very helpful !

    • @BoualiAli
      @BoualiAli  9 місяців тому

      Glad to hear that!

  • @ainigma100
    @ainigma100 7 місяців тому

    Thank you for the great video!

    • @BoualiAli
      @BoualiAli  6 місяців тому

      Glad you liked it!

  • @fadelkouyate1523
    @fadelkouyate1523 Рік тому +1

    Great content, thank you 🤩

    • @BoualiAli
      @BoualiAli  Рік тому

      my pleasure. Happy you liked it

  • @doomdota2641
    @doomdota2641 6 місяців тому

    great video ! clear explanation , thanks like it

    • @BoualiAli
      @BoualiAli  2 місяці тому

      Glad you liked it!

  • @RoxDelas
    @RoxDelas 9 місяців тому

    thanks bro, high quality!

    • @BoualiAli
      @BoualiAli  8 місяців тому +1

      Happy you liked it!

  • @BeingDeveloperWithAB
    @BeingDeveloperWithAB 3 місяці тому

    Very useful details.

  • @Im_not_scareddd
    @Im_not_scareddd Рік тому

    Nice stuffs ❤
    Keep going man

    • @BoualiAli
      @BoualiAli  Рік тому

      thanks. Happy you liked it

  • @arek9430
    @arek9430 9 місяців тому

    Golden content, thanks!

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @soumaya_ouertani
    @soumaya_ouertani 11 днів тому

    Bravo 🎉 merci 🙏

  • @thenriquedb
    @thenriquedb 9 місяців тому

    Great tutorial, thank you very much

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @user-ku7dh7od7i
    @user-ku7dh7od7i Рік тому +1

    best spring boot teacher ever

  • @soyjaider8996
    @soyjaider8996 4 місяці тому

    just that i need it, great video new suscriber

    • @BoualiAli
      @BoualiAli  3 місяці тому

      Thanks for the sub!

  • @AmadouSene-kn5pi
    @AmadouSene-kn5pi Рік тому

    very interesting, thank you for this video

  • @hatembenechikh7035
    @hatembenechikh7035 6 місяців тому

    you are saving lives , really thanks

    • @BoualiAli
      @BoualiAli  2 місяці тому

      Glad you liked it!

  • @vageeshanvageesh5583
    @vageeshanvageesh5583 Рік тому +1

    Great content, thank you man ❤

    • @BoualiAli
      @BoualiAli  Рік тому +1

      my pleasure. Happy you liked it

    • @vageeshanvageesh5583
      @vageeshanvageesh5583 Рік тому

      @@BoualiAli can we protect the api docs with basic auth for additional security?

  • @samuelstefancic8050
    @samuelstefancic8050 Рік тому

    Quel monstre, merci !

  • @boubakerjrad5002
    @boubakerjrad5002 Рік тому

    Thank you man good work

  • @kkmprod
    @kkmprod 11 місяців тому

    thanks for this amazing tutorial 🙏🙏🙏

    • @BoualiAli
      @BoualiAli  11 місяців тому

      Glad it was helpful!

  • @KuchNahiBasAiseHi
    @KuchNahiBasAiseHi 10 місяців тому

    Amazing video..thanks a lot.

    • @BoualiAli
      @BoualiAli  10 місяців тому

      Glad you liked it!

  • @mustaqimahmad1504
    @mustaqimahmad1504 11 місяців тому

    I am became your fan now.🙌

    • @BoualiAli
      @BoualiAli  11 місяців тому

      Welcome to the family

  • @tianadede349
    @tianadede349 7 місяців тому

    trop fort le mec, thank you

  • @DiplomasizKodcu
    @DiplomasizKodcu 10 місяців тому

    ohh thanks so much. This is now working...

  • @funnychannel1888
    @funnychannel1888 7 місяців тому

    Beautiful

  • @Olivier-Patrick
    @Olivier-Patrick 2 місяці тому

    great !

  • @2RAJ21
    @2RAJ21 15 днів тому

    thank you

  • @rediensE.
    @rediensE. 11 місяців тому

    I don't speak English, but I understood everything, Gracias!

    • @BoualiAli
      @BoualiAli  11 місяців тому

      Glad I could help!

  • @mahgsvtshh5444
    @mahgsvtshh5444 6 місяців тому

    Very Helpful

    • @BoualiAli
      @BoualiAli  2 місяці тому

      Glad you liked it!

  • @AmirElkased
    @AmirElkased 8 місяців тому

    Thanks Bouali ❤❤

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @theparten
    @theparten 6 місяців тому

    very intuitive❤...

  • @syedsharyarjavaid9853
    @syedsharyarjavaid9853 7 місяців тому

    I still get cannot load API definition even though I did permitAll() on all those URLs.

  • @KumarR-ps3be
    @KumarR-ps3be 5 місяців тому

    How do I get that URL link (server / UAT) from application.properties file for open API annotation. @value is showing error

  • @leekbiel
    @leekbiel 6 місяців тому

    Thank you!

  • @user-ew6rn2my7u
    @user-ew6rn2my7u Місяць тому

    What if I want to change the title of a web page in the window? (Swagge UI
    )

  • @rustamsaydam
    @rustamsaydam 7 місяців тому

    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...

  • @a7mdFathii
    @a7mdFathii 7 місяців тому

    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.

  • @harinathmarasani
    @harinathmarasani Місяць тому

    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 ?

  • @user-hq7cx8kb8q
    @user-hq7cx8kb8q 6 місяців тому

    Hi bro,
    can u please provide a tutorial on Apache Camel Integration Framework.
    for eg: (rest.xml and route.xml)

  • @girishanker3796
    @girishanker3796 8 місяців тому

    This is gold

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @sreetamasaha3399
    @sreetamasaha3399 8 місяців тому

    Thank you 😊

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Happy you liked it!

  • @dagnogoyaya5639
    @dagnogoyaya5639 Рік тому

    🥰 Very happy thanks you sir

  • @ismailforeveryone6889
    @ismailforeveryone6889 Рік тому +1

    Amazing content please keep going and please try to mention all things that sould not be in production

  • @babacarmane5434
    @babacarmane5434 Рік тому

    Merci beaucoup 🎉

  • @levibaraka
    @levibaraka Рік тому

    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

    • @BoualiAli
      @BoualiAli  Рік тому

      Can you please explain a bit more?

  • @KhoiNguyen-lb4lc
    @KhoiNguyen-lb4lc Рік тому

    Thank you so much....

  • @DanielPicuasi
    @DanielPicuasi 8 місяців тому +1

    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?

  • @crazyidea9143
    @crazyidea9143 Рік тому

    you are amazing..

  • @niteshyadav7819
    @niteshyadav7819 Рік тому +1

    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.

    • @BoualiAli
      @BoualiAli  Рік тому +1

      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");
      }

  • @Antonio-wc6rr
    @Antonio-wc6rr Рік тому

    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?

    • @BoualiAli
      @BoualiAli  Рік тому

      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

  • @maid768
    @maid768 9 місяців тому

    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

    • @BoualiAli
      @BoualiAli  8 місяців тому

      Check the documentation for ordering the endpoints

  • @sgaurav35
    @sgaurav35 Рік тому

    Can you make a small video on explaining about the Schemas in Swagger UI and how to make changes to it.

    • @BoualiAli
      @BoualiAli  Рік тому

      Can you please tell me more?

  • @orinda.harrison
    @orinda.harrison 11 місяців тому

    Thanks

    • @BoualiAli
      @BoualiAli  11 місяців тому +1

      Thank you and I really appreciate your support

  • @user-zl2ff3eh4o
    @user-zl2ff3eh4o 8 місяців тому

    Hi Ali,
    how can i hide the '/v3/api-docs/ Explore' section and the 'Servers' section on Swagger UI?

    • @BoualiAli
      @BoualiAli  7 місяців тому

      I never tried that.
      Let me check and come back to you

  • @ib-tihadj6199
    @ib-tihadj6199 Рік тому

    Thank you

  • @hanumanthram6754
    @hanumanthram6754 3 місяці тому

    Could you also cover @ApiResponses and @Pattern and validations of request body?

    • @BoualiAli
      @BoualiAli  2 місяці тому

      You can check the documentation for that

  • @philong7490
    @philong7490 Рік тому

    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!

    • @BoualiAli
      @BoualiAli  Рік тому

      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

  • @norulshahlamjohn1140
    @norulshahlamjohn1140 9 місяців тому

    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

    • @BoualiAli
      @BoualiAli  8 місяців тому +1

      Great suggestion!

  • @KlanBr1
    @KlanBr1 Рік тому

    In a post method, is it normal for the swagger to see empty parameters if I specify that it has a @RequestBody?

    • @BoualiAli
      @BoualiAli  11 місяців тому

      Nope, it should not

  •  7 місяців тому +1

    so slow and crashing with spring boot 3. also Init duration for springdoc-openapi is: 42494 ms

  • @mohammadasif5798
    @mohammadasif5798 4 місяці тому

    Thank you so much. It would be more helpful if you bring spring boot projects

  • @shakamuhammed533
    @shakamuhammed533 Рік тому +1

    Hello Ali, can you create a video on Angular e-commence full stack application.

  • @anhnguyen1701
    @anhnguyen1701 7 місяців тому

    how to make output colorful like you

  • @anjanx44
    @anjanx44 Рік тому +2

    We need more spring boot 3 tutorials like this.

    • @BoualiAli
      @BoualiAli  Рік тому +2

      Thanks.
      Please let me know what you want to see next

    • @anjanx44
      @anjanx44 Рік тому +1

      @@BoualiAli microservice

    • @BoualiAli
      @BoualiAli  Рік тому +2

      @@anjanx44 already published

  • @denismurashko843
    @denismurashko843 Рік тому

    Thanks for the video. Can I somehow download the specification, for example, when executing the gradle task?

    • @BoualiAli
      @BoualiAli  Рік тому

      Yes you can!
      You can use the openApi plugin to generate and download the specification

    • @denismurashko843
      @denismurashko843 Рік тому

      @@BoualiAli Thanks. I have done it. Is it possible also to download somehow the swagger-ui.html?

  • @samirallahverdiyev99
    @samirallahverdiyev99 Рік тому

    Please help me.İ get no operation defined in spec in swagger when add this dependency but server is correct

    • @BoualiAli
      @BoualiAli  Рік тому

      Can you show more details?
      Post on discord server with screenshots

  • @daboarder
    @daboarder 5 місяців тому

    Does this work with Gradle? I cant find an Implementation to get Swagger UI running.

  • @lesterbruke8166
    @lesterbruke8166 Місяць тому

    @Operation too cumbersome, makes it difficult to read the code

  • @mosestechtalk
    @mosestechtalk 10 місяців тому

    Thank you sir for this awesome tutorial, please how do I go deploy the swagger file?

    • @BoualiAli
      @BoualiAli  9 місяців тому

      where to deploy it?

  • @restlesschief
    @restlesschief Рік тому

    Can you share some insight into how we can inject some custom CSS in swagger ui ?

    • @BoualiAli
      @BoualiAli  Рік тому

      I never tried that.
      But, why do you need that?

  • @draveshsingh9868
    @draveshsingh9868 10 місяців тому

    Hello sir when I documents a multipart api this open ui not showing browse button how can I get

    • @BoualiAli
      @BoualiAli  9 місяців тому

      the endpoint should consume "multipart/form-data"

  • @safarboyalkhwarizmi
    @safarboyalkhwarizmi Рік тому

    What is your intellij theme by the way? I really like it

    • @BoualiAli
      @BoualiAli  Рік тому +1

      Thanks, this is the new theme from the newest version of Intellij

  • @universal4334
    @universal4334 3 місяці тому

    How does this openApiconfig are detected by springboot. We didnot create any bean right

    • @BoualiAli
      @BoualiAli  3 місяці тому

      it is a starter, so it is automatically detected

  • @beingsks457
    @beingsks457 8 місяців тому

    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

    • @BoualiAli
      @BoualiAli  8 місяців тому +1

      You can

    • @beingsks457
      @beingsks457 8 місяців тому

      @@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.

  • @afermeherremova5672
    @afermeherremova5672 3 місяці тому

    Where is the video about permissions, roles, authorizations? i can't find it