스프링 H2 DB 설정

tinyeye·2022년 12월 17일
0

스프링

목록 보기
2/10

1. 의존성 추가

  • build.gradle
runtimeOnly 'com.h2database:h2'

2. 설정 추가

  • application.properties
#h2설정
#h2 console 설정
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console

#h2 db 설정
spring.datasource.url=jdbc:h2:~/db이름;
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect

#jpa hibernate 설정
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.hibernate.ddl-auto=update
profile
백엔드 개발자를 노리며!

0개의 댓글