Spring Boot CurdRepository
(1) Spring Boot Data enables JPA repository support by default.
(2)
CrudRepository
provides generic CRUD operation on a repository for a specific type.(3) CrudRepository
is a Spring data interface and to use it we need to create our interface by extending CrudRepository
.
(4) Spring provides
CrudRepository
implementation class automatically at runtime. It contains methods such as save
, findById
, delete
, count
etc.
(5) Spring boot automatically detects our repository if the package of that repository interface is the same or sub-package of the class annotated with
Spring Boot provides default database configurations when it scans Spring Data JPA in classpath.
@SpringBootApplication
.Spring Boot provides default database configurations when it scans Spring Data JPA in classpath.
(6) Spring boot uses spring-boot-starter-data-jpa starter to configure spring JPA. For data source we need to configure data source properties starting with
spring.datasource.*
in application.properties.(7) CrudRepository
is an interface and extends Spring data Repository
interface.
(8)
CrudRepository
provides generic CRUD operation on a repository for a specific type.
(9) To use
CrudRepository
we have to create our interface and extend CrudRepository
. We need not to implement our interface, its implementation will be created automatically at runtime.
A Good read
No comments:
Post a Comment