(스프링) 스프링 코어 3 – JPA

0. JPA란?

ProductRepository.java :

public interface ProductRepository extends JpaRepository<Product, Long> { }

application.properties :

spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:springcoredb
spring.datasource.username=sa
spring.datasource.password=

이전 DI에서 보았듯이 JPA는 Bean을 등록하지 않고 application.properties에서 접근할 데이터베이스 정보를 지정하면 자동으로 DB에 연결된다.