πŸ“„ application.properties μ„€μ • 파일 μš”μ•½


# μ• ν”Œλ¦¬μΌ€μ΄μ…˜ 이름
spring.application.name=springboot-secret-diary

# πŸ’Ύ H2 μ½˜μ†” μ„€μ •
spring.h2.console.enabled=true              # μ›Ήμ—μ„œ H2 DB μ½˜μ†” μ‚¬μš© κ°€λŠ₯
spring.h2.console.path=/h2-console          # μ½˜μ†” 접속 경둜: <http://localhost:8080/h2-console>

# πŸ”Œ λ°μ΄ν„°λ² μ΄μŠ€ μ„€μ • (H2 λ©”λͺ¨λ¦¬ DB μ‚¬μš©)
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=

# πŸ—οΈ JPA μ„€μ •
spring.jpa.hibernate.ddl-auto=update        # μ„œλ²„ μ‹€ν–‰ μ‹œ DB ν…Œμ΄λΈ” μžλ™ μ—…λ°μ΄νŠΈ
spring.jpa.show-sql=true                    # μ‹€ν–‰λ˜λŠ” SQL 쿼리 μ½˜μ†” 좜λ ₯


🧠 각 μ„€μ • μ„€λͺ…

ν•­λͺ© μ„€λͺ…
spring.application.name 이 ν”„λ‘œμ νŠΈμ˜ 이름 (λ‘œκ·Έλ‚˜ λͺ¨λ‹ˆν„°λ§μ—μ„œ μ‚¬μš©)
spring.h2.console.enabled H2 μ½˜μ†” μ›Ή μ ‘κ·Ό ν—ˆμš© μ—¬λΆ€ (true둜 μ„€μ • μ‹œ 접속 κ°€λŠ₯)
spring.h2.console.path H2 μ½˜μ†” μ ‘κ·Ό 경둜 μ§€μ • (예: /h2-console)
spring.datasource.url H2 λ©”λͺ¨λ¦¬ DB 접속 μ£Όμ†Œ. DB_CLOSE_DELAY=-1은 μ•± μ’…λ£Œ μ „κΉŒμ§€ λ©”λͺ¨λ¦¬ μœ μ§€
spring.datasource.username / password DB 둜그인 정보 (H2 기본은 sa/빈 λΉ„λ°€λ²ˆν˜Έ)
spring.jpa.hibernate.ddl-auto=update μ—”ν‹°ν‹° 클래슀 기반으둜 DB μŠ€ν‚€λ§ˆ μžλ™ 생성/μ—…λ°μ΄νŠΈ
spring.jpa.show-sql=true μ‹€μ œ μ‹€ν–‰λ˜λŠ” SQL문을 μ½˜μ†”μ— 좜λ ₯ (디버깅에 도움됨)

βœ… 정리

μ‹€μ œ ꡬ동 μ˜ˆμ‹œ

image.png