Spring Boot RESTful CRUD API Tutorial with MySQL database

Поділитися
Вставка

КОМЕНТАРІ • 179

  • @smblog2354
    @smblog2354 2 роки тому

    Thanks! Adding for self reference.
    9:19 - dependencies,
    13:07 - pom.xml
    17:58 - Product.java code
    24:49 - instance of product repository in the product service.
    So the service interacts with the repo.
    32:09 - returns empty.
    35:29 - perform all these
    37:23 - @GetMapping, feching form apis, locally (postman)
    48:21 - http methods

    • @CodeJava
      @CodeJava  2 роки тому +1

      thanks for making these useful bookmarks.

    • @smblog2354
      @smblog2354 2 роки тому

      @@CodeJava Glad that its helpful.
      I have a doubt. So I purchased the udemy course for E cart app project, but I'm not able to clone it from GitHub, can someone guide me how to do this?.

  • @KCTsangKen
    @KCTsangKen 2 роки тому +3

    You video tutorial is very good. You've the talent to teach. This is the most straightforward beginner-level Spring Boot REST CRUD walkthrough I've ever watched. A Spring beginner can learn the basics from you without being confused by unnecessary details. Still there a couple of things I think you can improve: First, I think it is a better practice to create several packages so that the project structure looks more organized; second, with regard to the PUT method, you can write one {id} in the URI and a different "id" in JSON but it still works, as long as the URI {id} exists in mydb. I think a beginner should be aware of these two points.

    • @CodeJava
      @CodeJava  2 роки тому

      Thanks for your valuable feedback. I have plan to make a brand new video for this kind of tutorial. So stay tuned.

  • @programmingwithnish483
    @programmingwithnish483 3 роки тому +4

    Thank you my brother for uploading this. i need to implement web service using spring and hibernate for an upcoming project at work.. and the RequestEntity portion was really confusing me. This video really cleared it up. Thanks a ton brother.
    I have subscribed and I hope your channel grows from strength to strength.

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it helped. And thanks for the sub :)

  • @NoCodeDev
    @NoCodeDev 2 роки тому +3

    I've acquired few tricks to add to my spring boot knowledge ! thank you

  • @brazo98
    @brazo98 3 роки тому +4

    Dude that is absolute amazing 🤩 and awesome 😎. So you can programming a fully json server service app and in the other hand a mobile app for the view! Incredible really! Thanks I have a lot of ideas 💡 now. You are the ounce of the best framework teacher ever! Great eastern Dude! God bless you. 🖖🏻🖖🏻🖖🏻🖖🏻

    • @CodeJava
      @CodeJava  3 роки тому

      You're welcome. Glad you liked this video. Kindly come often.

  • @mboytandiayediallo6647
    @mboytandiayediallo6647 2 роки тому +1

    gracias tu video es muy claro

  • @angular-developer-e1t
    @angular-developer-e1t 4 роки тому +2

    Wonderful work. Thanks a lot. All material made with quality.

    • @CodeJava
      @CodeJava  4 роки тому

      So nice of you. Thanks for watching!

    • @angular-developer-e1t
      @angular-developer-e1t 4 роки тому

      @@CodeJava Only in application should be spring.jpa.hibernate.ddl-auto=update otherwize hibernate can't create system table for his work.

  • @HylianHanzou
    @HylianHanzou 2 роки тому

    Very helpful, liked and suscribed!

    • @CodeJava
      @CodeJava  2 роки тому

      Thanks for the sub!

  • @davidrosales4196
    @davidrosales4196 3 роки тому

    I use java 11 and maven 2.4.2 and it works!!

    • @CodeJava
      @CodeJava  3 роки тому +1

      Glad to know that. Have you checked my full playlist for Spring Boot here? ua-cam.com/video/B4IDlfT-53I/v-deo.html

  • @БоронбайКасымов
    @БоронбайКасымов 2 роки тому

    Thank you man. Good job.

  • @aniini
    @aniini 3 роки тому +3

    Thank You, this tutorial helped me a lot! I did not skip the ads to support you! :)

    • @CodeJava
      @CodeJava  3 роки тому +1

      You're great. Thank you too!

  • @hoangnguyen1634
    @hoangnguyen1634 3 роки тому

    thanks a lot. It's very helpful for me! Have a nice day

  • @RavinathFernando
    @RavinathFernando 3 роки тому +2

    Thank you Its very helpful and worked nicely on my demo crud project

  • @ankitkaushal7766
    @ankitkaushal7766 4 роки тому

    Amazing... much better content than the channels with more than 500k subscribers...

    • @CodeJava
      @CodeJava  4 роки тому

      Thank you. Glad you found it helpful :)

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

    Hi, Thanks a lot for the videos you make, they are really helpful..! I got an error while working on this which says Unsatisfieddependencyexception:error creating bean with name ..Contoller, Could you please help me with it

  • @mystoc3995
    @mystoc3995 2 роки тому

    great video, exactly what I was looking for!

    • @CodeJava
      @CodeJava  2 роки тому

      Glad you liked it!

  • @abinayachandrasekeran3051
    @abinayachandrasekeran3051 3 роки тому

    It was really so so useful! Such a clear teaching.Hats off to you!!

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it was helpful!

  • @jejakagentleman7638
    @jejakagentleman7638 3 роки тому

    well planned tutorial for beginners. Thanks

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it was helpful!

  • @keithnolan8238
    @keithnolan8238 3 роки тому

    Your videos are brilliant!!!!

    • @CodeJava
      @CodeJava  3 роки тому +1

      Wow, thank you!

    • @keithnolan8238
      @keithnolan8238 3 роки тому

      @@CodeJava If you had the time maybe you could make one on signup/login with user roles? Your videos are definitely the best I have come across. Thanks very much

    • @CodeJava
      @CodeJava  3 роки тому

      @@keithnolan8238 check this video: ua-cam.com/video/aRLoSDOlU3w/v-deo.html
      and this one: ua-cam.com/video/p18O0hSmQyM/v-deo.html

  • @jabert33
    @jabert33 2 роки тому

    Thank you much it works for me.

  • @yatendra__singh
    @yatendra__singh 4 роки тому +3

    Just incredible 😍

    • @CodeJava
      @CodeJava  4 роки тому +2

      thank you, glad you liked it.

    • @peacefulsky
      @peacefulsky 3 роки тому

      @@CodeJava ✅

  • @syedaqib2912
    @syedaqib2912 3 роки тому

    Amazing video...Really well explained

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it was helpful!

  • @kavyasri6374
    @kavyasri6374 3 роки тому

    Your video was very helpful

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it was helpful!

    • @kavyasri6374
      @kavyasri6374 3 роки тому

      Everything is working fine but only in PUT and POST , I am getting error as port number ended with "" and also port number out of range error,is there anything that we can do to rectify this error? It will be very helpful!

    • @kavyasri6374
      @kavyasri6374 3 роки тому

      I am getting this error in curl

  • @roshanaale7168
    @roshanaale7168 4 роки тому +1

    It helped me alot. Please provide such lesson with springboot security. It would be really helpful alot.

    • @CodeJava
      @CodeJava  4 роки тому

      Glad it helped. You can watch my playlist for Spring Boot Security here: ua-cam.com/video/d9t_trawaa0/v-deo.html

  • @juanguillermohernandezalar112
    @juanguillermohernandezalar112 4 роки тому +1

    God Job man!, Greetings from Colombia.

  • @fatmasenaogutcen7444
    @fatmasenaogutcen7444 3 роки тому

    Thank u. Very helpful video

    • @CodeJava
      @CodeJava  3 роки тому

      Glad it was helpful!

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

    Great videos

  • @vaishnavi_as
    @vaishnavi_as 4 роки тому +1

    Wow. Great Tutorial. Subscribed😀

    • @CodeJava
      @CodeJava  4 роки тому +2

      Thanks for the sub!

  • @Anonymous-ri3vu
    @Anonymous-ri3vu Рік тому

    I am getting a HTTP Status 500 - Internal Server Error while trying to run on the browser or in the command prompt. How to fix it?

  • @Maaa4216
    @Maaa4216 2 роки тому

    Super super sir thanks

  • @soumithnalli5169
    @soumithnalli5169 4 роки тому +1

    Thank you very much 🙏

    • @CodeJava
      @CodeJava  4 роки тому

      You're most welcome. Check my playlist for Spring Boot tutorials here: ua-cam.com/video/B4IDlfT-53I/v-deo.html

  • @potararaj2642
    @potararaj2642 4 роки тому

    Yu are going great job bro during this hard time

  • @abdelsalammegahed4497
    @abdelsalammegahed4497 4 роки тому

    if ID auto generation doesn't work with you,
    Check application.properties file.
    make sure that spring.jpa.hibernate.ddl-auto = update

  • @shelleyatwal
    @shelleyatwal 2 роки тому +1

    Thanks

    • @CodeJava
      @CodeJava  2 роки тому +1

      You're welcome. Glad it helped. And thanks for your $uper Thanks.

  • @asavarikalse3694
    @asavarikalse3694 2 роки тому

    Thank You

  • @vinaykumard1386
    @vinaykumard1386 2 роки тому

    Pls help me...am getting curl: no url specified in video at 46:52

  • @nguyenngochung6625
    @nguyenngochung6625 3 роки тому

    Chào bạn, Cảm ơn bạn về những chia sẻ rất hay và bổ ích cho cộng đồng!
    Tiện đây mình xin phép nhờ bạn tư vấn giúp mình 1 vấn đề.
    Mình có 1 cơ sở dữ liệu mysql, trong đó có nhiều table ( hàng trăm) có cấu trúc giống nhau, vậy bắt buộc mình phải tạo code trong Model cho từng table đó, hay có cách nào để mình chỉ cần tạo 1 class trong model, khi CRUD chỉ cần truyền tên table thôi.
    Cảm ơn bạn!

    • @CodeJava
      @CodeJava  3 роки тому +1

      nếu có cấu trúc giống nhau thì tại sao ko gom vào 1 table cho đơn giản? nếu như vậy thì database design chưa tối ưu.

    • @nguyenngochung6625
      @nguyenngochung6625 3 роки тому

      @@CodeJava Mình muốn tách ra vì nếu gộp lại 1 bảng thì số bản ghi sẽ rất nhiều, tốn nhiều thời gian để truy vấn và tính toán.

    • @CodeJava
      @CodeJava  3 роки тому

      @@nguyenngochung6625 bao nhiêu bản ghi vậy bản? bạn có dùng index để tối ưu truy vấn ko?

    • @nguyenngochung6625
      @nguyenngochung6625 3 роки тому

      @@CodeJava Dữ liệu khoảng 10 triệu bản ghi bạn.

    • @CodeJava
      @CodeJava  3 роки тому +1

      với CSDL và máy tính ngày nay thì 10tr record ko phải là nhiều. Bạn cần tối ưu thiết kế.

  • @haoyichiew6653
    @haoyichiew6653 3 роки тому

    nice video, but i have a question,
    how do we work with api that the object has a array in it?

    • @CodeJava
      @CodeJava  3 роки тому

      No issues at all. Just declare an array in the mapping class.

    • @haoyichiew6653
      @haoyichiew6653 3 роки тому

      @@CodeJava okay then how do we working on the database, i tried before there is parsing problem when declare my attributes as a string array

  • @phrangsnginongrum3150
    @phrangsnginongrum3150 2 роки тому

    Can postman be used in place of curl

    • @CodeJava
      @CodeJava  2 роки тому

      Sure, Postman provides easy-to-use GUI.

  • @inspirationalquotes5840
    @inspirationalquotes5840 3 роки тому

    How to render the rest api in the browser using thymeleaf?

    • @CodeJava
      @CodeJava  3 роки тому

      I think that's not a good idea. Thymeleaf renders the view directly from controller and model, not via Rest API.

  • @வருத்தப்படாதவாலிபர்-ழ9வ

    20:13 What's use of @id?? Why do it needed?? It's gonna work as same if not mentioned too.. then why??

    • @CodeJava
      @CodeJava  3 роки тому

      It marks the field mapping to a primary column in the database.

  • @vinaykumard1386
    @vinaykumard1386 2 роки тому

    Except getting list All are errors bro (url is bad/illegal not specified) pls give suggestions to solve this error brother

  • @StephenInKanata
    @StephenInKanata 4 роки тому

    Thanks, this was very very helpful!

    • @CodeJava
      @CodeJava  4 роки тому +1

      You're welcome!

    • @brendamoragwa2474
      @brendamoragwa2474 3 роки тому

      @@CodeJava you tired to explain well. Thank you so much

    • @CodeJava
      @CodeJava  3 роки тому

      @@brendamoragwa2474 you're welcome.

  • @othetai6297
    @othetai6297 4 роки тому

    sử dụng restcontroller với thymeleaf để up lên html như thế nào vậy anh

    • @CodeJava
      @CodeJava  4 роки тому

      anh chưa hiểu ý em là như thế nào?

    • @othetai6297
      @othetai6297 4 роки тому

      @@CodeJava em chưa hiểu làm thế nào để RestController trả data về html

    • @CodeJava
      @CodeJava  4 роки тому

      thường RestController chỉ trả về JSON thôi em ạ. HTML thì em dùng Spring MVC controller bình thường.

    • @othetai6297
      @othetai6297 4 роки тому

      @@CodeJava thanks anh :)

  • @jonathanpalominovega7837
    @jonathanpalominovega7837 3 роки тому

    What a great tutorial. Easy to understand and follow along. Keep up the good work. I subscribed to your channel in case you upload more content. Thank you for uploading this video.

    • @CodeJava
      @CodeJava  3 роки тому

      Thanks for the sub! Kindly check my full playlist for Spring Boot here: ua-cam.com/video/B4IDlfT-53I/v-deo.html

    • @prestondominik4332
      @prestondominik4332 3 роки тому

      I guess I'm kinda randomly asking but does anybody know a good site to watch newly released movies online?

  • @information_technologyg7834
    @information_technologyg7834 3 роки тому

    hi when try to view values by id i get an error . but i follow the every steps."Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.
    Wed Mar 10 01:19:53 IST 2021
    There was an unexpected error (type=Not Found, status=404)."

    • @CodeJava
      @CodeJava  3 роки тому

      ensure that you typed the URL correctly (no typos) and check the URL mapping.

  • @aniini
    @aniini 3 роки тому

    Hello! cảm ơn bạn again... by the way, I have used your code for my own table -- works well! One comment though, if a table column name uses camel case (eg FirstName)... it errors out. I renamed my table column names to have all lower case and it works.... but do you know any solution through code?

    • @CodeJava
      @CodeJava  3 роки тому +1

      the best practice is using underscores instead of camel case to avoid potential issues.

  • @RavindraKumar-st3or
    @RavindraKumar-st3or 4 роки тому

    Superb

  • @akashtripathi8421
    @akashtripathi8421 3 роки тому

    What if i want design with customized SQL query . I dont see where your SQLs are defined ?

    • @CodeJava
      @CodeJava  3 роки тому

      then you can use the @Query annotation in the repository interface. Check this tutorial which contains an example of a custom query: www.codejava.net/frameworks/spring-boot/spring-boot-spring-data-jpa-mysql-example

  • @gokulv1165
    @gokulv1165 3 роки тому

    I got the error like cannot convert from Optional to Product when using get by Id operation...could you help to fix it...Thanks in advance

    • @CodeJava
      @CodeJava  3 роки тому +1

      You need to call get() from the Optional object: Product p = optional.get()

    • @gokulv1165
      @gokulv1165 3 роки тому

      @@CodeJava Got it.Thank you..one more doubt...is this is a general procedure to make connection to sql ..should we must create an interface and service class...is that mandatory?

    • @CodeJava
      @CodeJava  3 роки тому +1

      @@gokulv1165 yes, that's the best practice

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

    I need help, I need a created_at attribute that tells me when I created a certain product !!

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

      so just add a new column of type DATETIME into the products table. In the service class, set createdAt to the current date and time (users do not have to specify this value).

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

      @@CodeJava Hello sir, everything's good, but I was now proposed to do orders ! Do you have anything related to that ? An Order needs to have an email associated ( No login needed ), the products and the total price... i need some help

  • @nagendra4078
    @nagendra4078 3 роки тому

    Super bro ...

  • @CraftMojo777
    @CraftMojo777 4 роки тому +1

    How to consume the api ? And then use it to build our complete web?

  • @praveenkumar-vn2yp
    @praveenkumar-vn2yp 4 роки тому +1

    When iam use same code which you have shown in your application iam getting error
    Like
    "There was an unexpected error(type=Internal Server Error, status=500)

    • @CodeJava
      @CodeJava  4 роки тому

      please post the detailed exception which contains the root cause.

    • @roshanaale7168
      @roshanaale7168 4 роки тому

      I think you passed the existProduct on PutMapping save() method you need to pass the product from the request body. I solved with this. I hope this helps

  • @OneCodingStep
    @OneCodingStep 4 роки тому

    awesome job , thanks a lot

    • @CodeJava
      @CodeJava  4 роки тому +1

      Glad it helped. You can also learn my full series for Spring Boot here: ua-cam.com/video/B4IDlfT-53I/v-deo.html

  • @information_technologyg7834
    @information_technologyg7834 3 роки тому

    hi. i want to connect spring boot rest api to androd studio . but i can't find any tutorial for it

    • @CodeJava
      @CodeJava  3 роки тому

      in Android app, you should make AJAX call to the RESTful webservices. Check this thread on Stackoverflow: stackoverflow.com/questions/34762273/android-ajax-in-java

    • @information_technologyg7834
      @information_technologyg7834 3 роки тому

      @@CodeJava thank you so much for your supporting

  • @DLuffy-ASL
    @DLuffy-ASL 3 роки тому

    Spring Boot hibernate Validator not working ...what to do???

    • @CodeJava
      @CodeJava  3 роки тому

      kindly tell me the error in details

  • @vivekwarjurkar6452
    @vivekwarjurkar6452 3 роки тому

    Hey , I am getting 500 server error after hitting /products API , Its giving error as " This application has no explicit mapping for /error, so you are seeing this as a fallback.
    Tue Apr 06 18:37:41 IST 2021
    There was an unexpected error (type=Internal Server Error, status=500)." what could be the possible issue.

    • @CodeJava
      @CodeJava  3 роки тому

      See the console for the actual error (internal server error).

    • @vivekwarjurkar6452
      @vivekwarjurkar6452 3 роки тому +1

      @@CodeJava I got the issue , the db table should be "product" and the table i created was "products".
      Thanks @Code Java for this outstanding tutorial , 🔥

    • @CodeJava
      @CodeJava  3 роки тому +1

      @@vivekwarjurkar6452 glad you fixed it.

    • @granthsaar4808
      @granthsaar4808 3 роки тому +1

      I got the same error can you please help i havent made mistake in table name as i checked ...

    • @vivekwarjurkar6452
      @vivekwarjurkar6452 3 роки тому +1

      @@granthsaar4808 check the detailed error in console .
      It has the answer to most of the problems , and you will be able to fix by urself .
      You can paste your stack trace here as well .

  • @deepakrajs3860
    @deepakrajs3860 4 роки тому

    Hello, make video for how to save and fetch images from mysql database using spring mvc, could you help me in that case

    • @CodeJava
      @CodeJava  4 роки тому +1

      I will publish a video like that. Thanks for your great suggestion. Kindly be patient.

    • @nagendrapp2213
      @nagendrapp2213 4 роки тому

      @@CodeJava really need this type of video

  • @er_ma3
    @er_ma3 4 роки тому

    You can use Spring tool suit

  • @lakshminarayanam.l.8989
    @lakshminarayanam.l.8989 3 роки тому

    Got jdbc driver error couldn't move forward

    • @CodeJava
      @CodeJava  3 роки тому

      what is the error in details?

  • @hamdimahjoub294
    @hamdimahjoub294 4 роки тому

    Thank you !

    • @CodeJava
      @CodeJava  4 роки тому

      You're welcome! Come back to see my channel more often as I publish videos regularly.

  • @arulmurugan6878
    @arulmurugan6878 4 роки тому

    hi sir Spring Boot RESTful web services APIs application video post please

  • @ajaygoel7889
    @ajaygoel7889 4 роки тому

    Nam, increase the editor font.Thanks a lot for the video

    • @CodeJava
      @CodeJava  4 роки тому

      Font size was increased. Isn't it enough for you?

  • @VitaliKiSS
    @VitaliKiSS 3 роки тому

    Unknown column 'societa_so0_.id_societa_solonari' in 'field list' -RIP

    • @VitaliKiSS
      @VitaliKiSS 3 роки тому +1

      solved: spring.jpa.hibernate.ddl-auto=update in application.properties

  • @SantoshSharma-qp5fr
    @SantoshSharma-qp5fr 4 роки тому

    Sound needs improvement. Contents are good.

  • @rubikorp9398
    @rubikorp9398 4 роки тому

    thanks

  • @meghananallamilli6798
    @meghananallamilli6798 2 роки тому

    Pls help me out ASAP

    • @CodeJava
      @CodeJava  2 роки тому

      tell me what your issue is, in details.

  • @tevinntsakohlungwani7839
    @tevinntsakohlungwani7839 3 роки тому

    insightful video bad sound

    • @CodeJava
      @CodeJava  3 роки тому

      thanks for watching anyway.

  • @vaibhavgaur8200
    @vaibhavgaur8200 3 роки тому

    subscriber + 1 :)

  • @HaiHai-xg4ip
    @HaiHai-xg4ip 3 роки тому

    are you VietNamese ?

    • @CodeJava
      @CodeJava  3 роки тому

      yes, I am.

    • @HaiHai-xg4ip
      @HaiHai-xg4ip 3 роки тому

      @@CodeJava I'm VietNamese, too. I learned a lots from you. Thank you so much. Where are you at Viet Nam ?

    • @CodeJava
      @CodeJava  3 роки тому

      @@HaiHai-xg4ip good morning from Da Nang city

  • @stas4985
    @stas4985 4 роки тому

    hi man

  • @deepnamdev5744
    @deepnamdev5744 2 роки тому

    your voice is not to teach instead it is a best way to sleep.

    • @CodeJava
      @CodeJava  2 роки тому

      oh, sorry to hear that. Follow the written tutorial instead: www.codejava.net/frameworks/spring-boot/spring-boot-restful-crud-api-examples-with-mysql-database

    • @deepnamdev5744
      @deepnamdev5744 2 роки тому +1

      Thank u so much now I can study because your content is very good.

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

    I dont know why I got this Not a managed type: class com.apolis.main.Product even though I follow your structure. put everything in same main package

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

      check the package of the main class. Also follow this video: ua-cam.com/video/ug53epaPFrA/v-deo.html

  • @Naanu_kartik
    @Naanu_kartik 3 роки тому

    Thank you so much 🙏

    • @CodeJava
      @CodeJava  3 роки тому +1

      You're welcome 😊