Spring

 Bean - The object that form the backbone of your application and that are managed by the Spring IoC container are called beans.

A bean is an object that is instantiated, and otherwise managed by a Spring IoC container. These beans are created with the configuration metadata that you supply to the container.



@Repository - means this class represents table in database. Means this table works with database.

Repository: A repository is the class that interacts with the database. It performs operations on the database, like creating, updating, deleting entries, etc.

@Component - like <bean> in Spring XML. If we want Spring to rule our class then we put @Component annotation.

@Service - do some logic.

@Entity. Entity: An entity is what gets stored in a database. It is a POJO class, with the annotation @Entity. It also has the table name in the database mentioned with the help of an annotation @Table (name = “students_table”). Also, each attribute can be optionally given a column name using the @Column annotation. 

One key point to note is that an Entity is what gets stored in a database. A repository is what interacts with a database (there’s a difference).


Комментарии

Популярные сообщения из этого блога

Lesson1: JDK, JVM, JRE

SE_21_Lesson_11: Inheritance, Polymorphism

SE_21_Lesson_9: Initialization Blocks, Wrapper types, String class