반응형
build.gradle 의존성 추가
runtimeOnly group: 'com.h2database', name: 'h2', version: '1.3.175'
application.yml 에 db 설정
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
username: sa
password:
h2:
console:
enabled: true
settings:
web-allow-others: true
path: /h2-console
spring.datasource.url
- jdbc:h2:mem:test : test DB에 In memory로 동작 ( DB_CLOSE_DELAY=-1 사용해주면 데이터 유지할 수 있음)
- jdbc:h2~/test : 로컬 DB
반응형