스프링 h2 db 연결

JP·2022년 5월 22일
0

spring

목록 보기
5/5

항상 까먹어서 적어둔다...

build.gradle 파일에 아래와 같이 h2데이터베이스에 대한 디펜던시 추가

dependencies {
    ...
    ...
    ...
	runtimeOnly ("com.h2database:h2")
}

application.yml에 아래와 같이
h2디비 정보 추가

profiles active: local로 둔 이유는 로컬에서만 동작하게 하려고.

spring:
    profiles: 
        active: local
    datasource:
        driver-class-name: org.h2.Driver
        url: jdbc:h2:mem:testdb
        username: sa
        password:
profile
to Infinity and b

0개의 댓글