Science & Technology

#21 Project using Spring | Project Setup with Model

by Telusko

Share:

📚 Main topics

  • Spring Boot project setupA backend project is created with Spring Web, Spring Data JPA, DevTools, Lombok, and H2 dependencies. The application is run to confirm that the selected port is available. 0:00
  • Database configurationThe application properties are set up with an H2 database URL and driver, SQL logging, and a JPA schema setting to update existing tables. 2:41
  • Product modelA Product entity is planned with an ID, name, description, brand, price, category, release date, availability, and stock quantity. Image handling is left for a later video. 4:13
  • Project packages and controller checkModel, controller, service, and repository packages are created. A simple REST controller returns “Hello World” to verify that the application responds to a request. 6:18
  • Entity and database tableThe Product class uses Lombok annotations and is marked as a JPA entity with an ID field. Running the application creates a product table, which is verified through the H2 console. 8:57

✨ Key takeaways

  • Choose suitable data typesThe price is represented with BigDecimal rather than an integer, while availability is a Boolean and quantity is an integer. 8:57
  • JPA creates the tableMarking Product as an entity and identifying its primary key allows JPA to create the table in the database. 10:00
  • Verify the setup before continuingThe greeting endpoint and H2 console confirm that the application runs and the product table exists, although it contains no data yet. 7:53

🧠 Lessons learned

  • Keep the initial model focusedThe product model starts with essential product details, while image support is postponed to keep the setup straightforward. 4:13
  • Use schema updates during developmentThe update setting avoids recreating the database table every time the application restarts. 3:11

🏁 Conclusion/next steps

  • Prepare to add data and backend layersThe project structure and Product entity are ready, but the service and repository layers and product-specific controller still need to be built. Sample data will be added in the next video. 11:33

Transcript excerpt

0:00 so now it's time to build the back end for this application so we got the front end ready and we have talked about it in the last session or in the last video but now let's build a back end so I don't want this m message which says something went wrong let's make it work okay so when you say backend how do we do it it's very simple we have done this before we have to create a Spring Boot web project a new project we don't want to make changes in the older one so I will say Maven project Java the version remains same the group ID is as usual comiso the project name the artifact ID

0:33 uh I will want to make it as Ecom project I will say one uh okay let's say com project we'll make keep making changes in the same project and the jar packaging the Java version 21 now it's time for the dependencies now since this is a web spring web project I will need web I don't want to create a ref repository here the way we have done in one of the video is because I want some customization so I will prefer web uh the next thing is I want database connect as well so I will say jpa is

🔒 The full, searchable transcript is available with Pro.

🔒 Unlock Premium Features

This is a premium feature. Upgrade to unlock unlimited Q&A, transcripts, mindmaps, and translations.

🔒 Unlock Premium Features

Access to Chat is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Mindmap is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Translation is a premium feature. Upgrade now to unlock unlimited studying tools.

Get unlimited summaries, Q&A, transcripts and more with Pro

Upgrade to Pro

Suggestions

🔒 Unlock Premium Features

Access to AI Suggestions is a premium feature. Upgrade now to unlock unlimited studying tools.