PostgreSQL

다운로드 https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

pom.xml 작성

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <scope>runtime</scope>
</dependency>

application.properties

application.yml

UserInfo 객체 생성 (user_info 테이블과 매핑)

interface 작성

결과

pgadmin

다 만들고 생각해보니 mysql 설정할때랑 별로 다른게 없어보인다. pom 수정 , application.yml 파일 수정 하는 부분만 다를뿐. 이것이 바로 JPA 매력이다. 추상화로 되어 있어 db를 어떤 제품으로 변경하든지 java code 는 변경되는 부분으 매우 적거나 없다.

끝!

Last updated