JPA

[JPA] *Springboot Starter Project - 프로젝트 설정하기

Song hyun 2024. 9. 30. 11:26
728x90
반응형

[JPA] *Springboot Starter Project - 프로젝트 설정하기

 

  • (1) Springboot Starter Project 생성
  • (2) 스프링부트 버전 : 3.2.10
  • (3) API 설정
  • -[web]: spring web
  • -[developer tools]: 롬복, Spring Boot Devtools
  • -[SQL]: H2, JPA

 

 

 

(4) build.grade() - [refresh]하기

 

 

(5) application 파일의 확장자를 properties에서 yml로 바꾸기

(6) application.yml 작성하기

spring:
  application:
    name: demo
    
  server:
    port: 8080
  datasource:
    url: jdbc:h2:mem:testdb
    driver-class-name: org.h2.Driver
    username: sa
    password:
    
  jpa:
    hibernate:
      ddl-auto: create  # 하이버네이트의 DDL 자동 실행 옵션
  
  h2:
    console:
      enabled: true  # H2 콘솔 웹 인터페이스 활성화
      path: /h2-console  # H2 콘솔에 접근할 수 있는 경로 설정 
      
# 디버깅을 위한 로깅
logging:
  level:
    org:
      springframework:
        jdbc: DEBUG
        hibernate:
         SQL: DEBUG

 

 

(7) h2에 접속해보기 (http://localhost:8080/h2-console)

*혹시 접근이 안 된다면, h2의 JDBC URL에 jdbc:h2:mem:testdb 를 넣어보자!!

728x90
반응형