#component #annotations #stereotype #springboot #repository #jpa #JPAannotations #springboot #springframework #javatraining #javatutorial #service #entity #applicationproperties
🚀 Source code : https://gitlab.com/javabootprogrammer...
@Component
-------------------------------------------------------------------------------------------------------------------------------------------------------
In Spring Boot, the @Component annotation is a generic stereotype annotation used to mark a class as a Spring-managed component, making it eligible for automatic discovery and dependency injection. It is part of the Spring Framework and is used to indicate that the class should be automatically detected during classpath scanning and registered as a Spring bean
@Repository
-------------------------------------------------------------------------------------------------------------------------------------------------------
The @Repository annotation in Spring Boot is a specialization of the @Component annotation, which indicates that the class is a repository and is part of the persistence layer. It is mainly used to indicate that the class interacts with a database to retrieve, update, delete, or perform other persistence-related operations.
@Service
-------------------------------------------------------------------------------------------------------------------------------------------------------
In Spring Boot, the @Service annotation is used to indicate that a class serves as a service component in the application’s service layer. It is a specialization of the @Component annotation, and Spring manages these classes as beans, allowing dependency injection and other features to be applied.
📣 Spring Initializer : https://start.spring.io/
application properties
-------------------------------------------------------------------------------------------------------------------------------------------------------
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.jpa.show-sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql=TRACE
✍️ All tutorials : https://gitlab.com/javabootprogrammer
▬▬▬▬▬▬ T I M E S T A M P S ⏰ ▬▬▬▬▬▬
00:00 Welcome to the channel
00:05 Spring Sample Application
00:19 MVC Design pattern
01:15 What is @Component Annotation?
02:31 What is @Repository Annotation?
03:20 What is @Service Annotation?
03:50 What is H2 database?
04:47 Project Creation plan
05:21 Spring.io project creation
08:06 create Entity Class
09:04 create Repository interface
09:45 create Service class
11:45 create a Component class
14:49 update main method
15:35 Run the Application