Spring

SpringBoot JPA - h2 DB 접속하는 법(drop table if exists 테이블명 cascade)

탐훈 2023. 11. 19. 16:22
728x90

8080으로 서버를 띄웠다고 가정

 

http://localhost:8080/h2-console

 

로그에 

drop table if exists 테이블명 cascade

 

라고 떴다면

 

appication.properties 혹은 application.yml을 수정해야함

 

server:
  port: 8081

spring:
  jpa:
    show-sql: true
    properties:
      hibernate:
        format_sql: true
    defer-datasource-initialization: true
    ddl-auto: create
  datasource:
    url: jdbc:h2:mem:testdb
  h2:
    console:
      enabled: true