How to create an REST API in Spring boot using Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น •

  • @rhtonmoy
    @rhtonmoy ปีที่แล้ว +23

    Brother, you are the best. What a great way of explaining Springboot rest API in short. Thanks for sharing ❤

  • @mauricemakesmovies
    @mauricemakesmovies ปีที่แล้ว +20

    Clear instructions and it was a quick and short introduction to REST APIs in SpringBoot. Thumbs up!

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      Happy to hear you enjoyed my approach!

  • @lnlupo95
    @lnlupo95 10 หลายเดือนก่อน +6

    Nice content! I wanted a quick look into Spring boot and your video served me well! Thanks!

  • @Oi-mj6dv
    @Oi-mj6dv ปีที่แล้ว +42

    Very nice. Problem is i just remembered why i hate java so much.

  • @ibrahimhalim9211
    @ibrahimhalim9211 3 หลายเดือนก่อน +1

    What a great way of explaining Spring Boot REST API in such a short and clear manner! thank's for sharing

    • @Randomcode_0
      @Randomcode_0  3 หลายเดือนก่อน

      Glad you enjoyed it!

  • @rohitchanda8461
    @rohitchanda8461 ปีที่แล้ว +9

    This is simply brilliant! Goldmine your channel is! Keep up the amazing work!
    PS - a detailed and complete playlist on Spring Boot right from scratch would be awesome! A playlist that introduces one to the world of Spring Boot and makes him a pro like you! Would love to follow that religiously ❤

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      Thank you! I might create a more general introduction to spring boot at some point.

    • @rohitchanda8461
      @rohitchanda8461 ปีที่แล้ว

      @@Randomcode_0 Waiting eagerly for that. Also, I tried writing this API by following along, however I am not getting any output on Postman. HTTP Status Code is 200 OK but still is no output. Could you tell me why?

  • @damilola_adegunwa
    @damilola_adegunwa 2 ปีที่แล้ว +5

    hurray! final my first java rest api ran! thanks a lot! now my java journey begins, wish me luck 🤣🤣

    • @Randomcode_0
      @Randomcode_0  2 ปีที่แล้ว

      Best of luck!

    • @ahsem
      @ahsem ปีที่แล้ว

      hurray!

  • @InfoSecGSO
    @InfoSecGSO 4 หลายเดือนก่อน

    Excellent tutorial. It never ceases to amaze me the directory depth of a Java project/code base. Thanx for making this one easy to follow along with.

    • @Randomcode_0
      @Randomcode_0  3 หลายเดือนก่อน

      Thanks! Java projects can be a maze, but I'm glad this tutorial made it easier to navigate.

  • @lennartreinecke4553
    @lennartreinecke4553 11 หลายเดือนก่อน +3

    What window do you open at 9:56?

  • @abernau1
    @abernau1 ปีที่แล้ว +2

    Thanks a lot! Great as an introduction to the Spring boot. Concise, clear and easy to follow.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      Thank you for the kind feedback! I'm glad the Spring Boot introduction was concise, clear, and easy to follow. If you have any more questions, feel free to ask!

  • @viralworld718
    @viralworld718 5 หลายเดือนก่อน

    I use to mever comment bt this one is the bbest waay to explain .. this is actualy what people r looking in youtube instsd of full tutorial

    • @Randomcode_0
      @Randomcode_0  5 หลายเดือนก่อน

      Thank you so very much. It is very much my goal to be as straight to the point as possible to not waste anyone's time.

  • @RioThejenero
    @RioThejenero ปีที่แล้ว

    Most usefully video I have ever seen in my entire life. Ty bro

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      Wow! Thanks for the awesome comment! I'm thrilled that you found the video incredibly useful.

  • @whatcanihave08
    @whatcanihave08 ปีที่แล้ว +1

    Nice content. Quick and easy to understand. Awesome for quick brush up before interviews.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      Glad you liked it! If you have any other topics that might be interesting to brush up on, I would love to get some input.

  • @TalhaBsbyk
    @TalhaBsbyk 4 หลายเดือนก่อน +2

    Do I need to understand why you do everything you do? Because I have no idea what all those imports are and what they are doing. Apart from that thanks for this guide, it worked for me!

    • @Randomcode_0
      @Randomcode_0  4 หลายเดือนก่อน

      Think of imports as references to other Java code (libraries). You don't need to worry about them too much, as tools like IntelliJ make managing them very simple. If you create a class and want to use it elsewhere, you'll need an import statement pointing to the location of that class.

  • @cristophermolina2721
    @cristophermolina2721 ปีที่แล้ว +1

    Loved it! Just wanted to know if you know the way to implement the post method.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      It is done in more or less the same way using a "@PostMapping" annotation.

  • @newfoundland1956
    @newfoundland1956 6 หลายเดือนก่อน

    Thanks just what I needed so I subscribed

    • @Randomcode_0
      @Randomcode_0  5 หลายเดือนก่อน

      Thanks for the sub!

  • @sandeepsahanicodes
    @sandeepsahanicodes 2 หลายเดือนก่อน

    Thanks for the video!

  • @dasgill4761
    @dasgill4761 2 หลายเดือนก่อน +1

    Shortcut to create a for loop in IntelliJ - type ‘iter’

  • @lilMerla
    @lilMerla ปีที่แล้ว +1

    Thanks for the video. it was genuinely helpfull and easy to understand 😊👏

  • @christio02
    @christio02 ปีที่แล้ว

    Thank you for the tutorial!

  • @ponchobob
    @ponchobob ปีที่แล้ว

    hi, nice video. how did you disable the security part? i'm always redirected to a login page when calling the full api path in a browser.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      Sorry for the late reply. I would assume you have added Spring Security, which will provide login functionality even without any extra setup.

  • @PAUL1430
    @PAUL1430 ปีที่แล้ว

    thank you for this video. it helps me well! Could you tell me what is the difference between rest api vs restFul api?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      In short:
      REST API: used to describe any API that follows the principles of REST to some extent.
      RESTful API: should follow all the constraints of REST.
      But people often think of them as the same thing and they are used interchangeably.
      The Constraints of REST are:
      - Client-Server Architecture
      - Statelessness
      - Cacheability
      - Uniform Interface
      - Layered System
      - Code-On-Demand (Sometimes Optional)

    • @PAUL1430
      @PAUL1430 ปีที่แล้ว

      @@Randomcode_0 thank you champ

  • @haisesasaki3372
    @haisesasaki3372 ปีที่แล้ว +2

    So I have to use ultimate version just to use spring on this IDE?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      You can still use the IDE, you just can't use the built-in Spring project builder. However, it is the same project builder as on Spring's own website. You just need to create the project and then open it using IntelliJ. You can then just create an empty Maven project and import the dependencies or use the Spring Initializer: start.spring.io/

  • @BlueXDShadow
    @BlueXDShadow ปีที่แล้ว

    Thanks for the tutorial.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      You're welcome! Glad it was helpful for you.

  • @ArthurSchoppenweghauer
    @ArthurSchoppenweghauer 2 หลายเดือนก่อน +1

    I love the part where he doesn't explain why he's doing things this way.

  • @ricardovaltierra8858
    @ricardovaltierra8858 5 หลายเดือนก่อน

    Awesome 👌 Thank you 💯

  • @vanbap
    @vanbap 3 หลายเดือนก่อน

    at the step that using Get Request in Postman, I got this Error: " {
    "timestamp": "2024-09-09T09:59:17.776+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "path": "/user"
    }"
    Did anyone know the reason and how to fix this ? Thank u guys so much

  • @onthego22
    @onthego22 ปีที่แล้ว

    how did you get spring initializer inside intelij ? is it community edition or ultimate?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      I am using the ultimate edition. This makes the setup a bit simpler. The same project can be created using spring boots' initializer.

  • @bugraosmansoysal9118
    @bugraosmansoysal9118 10 หลายเดือนก่อน

    Great video, thank you lots ❤

    • @Randomcode_0
      @Randomcode_0  10 หลายเดือนก่อน

      You're welcome 😊 Glad you like it!

  • @bryanjonathan407
    @bryanjonathan407 8 หลายเดือนก่อน

    the more i watched the videos . the more im confuse about his explanation . please explain it more detail and tell us why we should use the things that you said

  • @WRPXV
    @WRPXV ปีที่แล้ว

    Awesome!, thanks for sharing it. 🤓

  • @alonerpro
    @alonerpro 2 หลายเดือนก่อน +1

    Is there any way to love java?

    • @Randomcode_0
      @Randomcode_0  2 หลายเดือนก่อน

      I think you misspelled: 'Is there any way not to love Java?', or you are missing the punchline to your joke :)

    • @alonerpro
      @alonerpro 2 หลายเดือนก่อน

      @@Randomcode_0 for work I need to learn Java coming from a python background. Need love for Java.

  • @michaelfeeler1041
    @michaelfeeler1041 10 หลายเดือนก่อน

    Can someone please explain the return statement syntax inside the if statement of the controller?

    • @gehtdichnichtsan2194
      @gehtdichnichtsan2194 10 หลายเดือนก่อน +1

      as far as i understood: 9:32
      row 24: the optional "user" will be filled with the values of the given id. If id>= 6, it will be empty in this example.
      row 25: if the optional "user" got data (id 1-5), it will return the optional (row 26) as it has an actual value and stops there.
      row 28: it will return nothing, if it comes to this return (id>=6)

    • @michaelfeeler1041
      @michaelfeeler1041 10 หลายเดือนก่อน

      @@gehtdichnichtsan2194 thanks for the reply! Do you know why User is put in parentheses like that? (User). It’s the first time I’m seeing that syntax and can’t find answers with google. Any documentation would be appreciated.

    • @gehtdichnichtsan2194
      @gehtdichnichtsan2194 10 หลายเดือนก่อน

      @@michaelfeeler1041 if you follow the link in his description to github, you can find another solution, which should be better. However there you will stumble uppon the parentheses aswell.
      @GetMapping("/user")
      public User getUser(@RequestParam Integer id){
      Optional user = userService.getUser(id);
      return (User) user.orElse(null);
      the "(User)" is a type cast which should make sure that the return value gets interpreted as the User object. the returnvalue in this case is "user.orElse(null)" i personally would go with the github solution as it is shorter.

  • @nk461
    @nk461 ปีที่แล้ว

    Please increase the font size in your new videos!

  • @thesquarefish
    @thesquarefish ปีที่แล้ว

    OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended? I copied the video exactly but I got this error. What does it mean?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      The warning message indicates that the JVM is unable to enable sharing for classes outside of the boot loader classes due to modifications in the bootstrap classpath. Check dependencies and project configuration, or update your JDK to resolve the warning.

  • @nald-dev
    @nald-dev ปีที่แล้ว

    Thank you for this

  • @sushmithaalla
    @sushmithaalla ปีที่แล้ว

    how to write docker file in eclipse

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      I'm not entirely sure I fully understand your question. You can create a Dockerfile anywhere; it just needs to be named "Dockerfile," and it should work.

  • @orcestragamer3058
    @orcestragamer3058 ปีที่แล้ว

    Sir, can I add this in my resume under project section? because it only do crud so is it worth to add?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      Absolutely! Including this CRUD project in your resume can demonstrate your ability to create functional applications, which could be relevant to potential employers. Just be sure to highlight the skills and technologies you utilized in the project.

  • @xeryan9744
    @xeryan9744 ปีที่แล้ว

    what IDE is this. looks clean

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      I am using the Intellij IDEA, which is an idea made by Jetbrains.

    • @musashi542
      @musashi542 ปีที่แล้ว +1

      if u are a student u cant get it for free

  • @nephylumsaracen6722
    @nephylumsaracen6722 ปีที่แล้ว

    Is that you, Alex????😂😂😂😂

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      I am sorry to disappoint, but my name is not Alex.

  • @sushilbhagat1405
    @sushilbhagat1405 ปีที่แล้ว

    Nice

  • @lucashayashii
    @lucashayashii 7 หลายเดือนก่อน

    Thanks!

  • @mongolhvv
    @mongolhvv ปีที่แล้ว

    Thank you

  • @joshuamc8617
    @joshuamc8617 ปีที่แล้ว

    source code pls?

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว +1

      Added to the description, and here is the link as well: gist.github.com/Da9el00/b9c3280b69ea0291227cf005f090a319

  • @ShubhamSoni-tp5yt
    @ShubhamSoni-tp5yt หลายเดือนก่อน

    Thanks

  • @lucascubile7141
    @lucascubile7141 3 หลายเดือนก่อน

    Jesus christ so verbose. I come from a TypeScript background lolz. Is this usual for java springboot apis?

    • @Randomcode_0
      @Randomcode_0  3 หลายเดือนก่อน

      I might be a bit biased in my opinion, but compared to older versions of Java and not using frameworks like Spring Boot, this seems like a simple solution to me.

    • @lucascubile7141
      @lucascubile7141 3 หลายเดือนก่อน

      @@Randomcode_0 No idea. Never worked with a single version of Java.

  • @user-td5gy2fh3p
    @user-td5gy2fh3p ปีที่แล้ว

    What is this garbage ultra compressed audio?

  • @ragnarlothbrok367
    @ragnarlothbrok367 ปีที่แล้ว

    paywall ide, thumbs down

    • @mauricemakesmovies
      @mauricemakesmovies ปีที่แล้ว

      ??? you can do the same things in many other ide's though.

  • @jimbo5437
    @jimbo5437 ปีที่แล้ว +1

    getting a 404 status error not found path / and i did everything you did to the T with no errors.

    • @Randomcode_0
      @Randomcode_0  ปีที่แล้ว

      If you are receiving a response of 404, you are hitting the correct port. However, you should double-check that you are using the correct URL and have the same endpoint defined in your controller (Spring Boot endpoints are also Case Sensitivity by default). The 404 error indicates that you might be on the wrong URL. You would encounter a 500 server error if you hit the correct endpoint but your backend is experiencing issues. Otherwise, you can view all of my code at: gist.github.com/Da9el00/b9c3280b69ea0291227cf005f090a319

    • @tasoscat4295
      @tasoscat4295 ปีที่แล้ว +1

      @@Randomcode_0 im getting the same error. I completely copy pasted the source code from your git to be sure. Still same problem.

    • @ihordoroshenko2158
      @ihordoroshenko2158 9 หลายเดือนก่อน

      I tried to change jdk version to 17, it didn't really help, but after that I noticed that the code in video is not the same as on his Github and the important row where you define in controller, model, and service the package name is missed in the Github-files. Just add it and it should work - I hope it helps everyone who still has this problem

    • @Subnetzero
      @Subnetzero 4 หลายเดือนก่อน

      Make sure to update the @GetMapping to @GetMapping(“/user”)