From 17d0d88b35d78244f3b6fef85c0087a8fbb5ef5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=8A=B9=EC=97=B0?= Date: Thu, 4 Jul 2024 21:09:20 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20DB,=20JPA=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++-- .../java/com/umc/dream/DreamApplication.java | 2 ++ src/main/resources/application.yml | 20 ++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index ad496dd..a124aac 100644 --- a/build.gradle +++ b/build.gradle @@ -24,12 +24,12 @@ repositories { } dependencies { - //implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' // swagger compileOnly 'org.projectlombok:lombok' - //runtimeOnly 'com.mysql:mysql-connector-j' + runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' diff --git a/src/main/java/com/umc/dream/DreamApplication.java b/src/main/java/com/umc/dream/DreamApplication.java index 66d9e63..f4f5a00 100644 --- a/src/main/java/com/umc/dream/DreamApplication.java +++ b/src/main/java/com/umc/dream/DreamApplication.java @@ -2,7 +2,9 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +@EnableJpaAuditing @SpringBootApplication public class DreamApplication { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index de6af51..31cb7b5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,25 @@ spring: application: name: dream - + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${DB_URL} + username: ${DB_USER} + password: ${DB_PASSWORD} + sql: + init: + mode: never + jpa: + properties: + hibernate: + dialect: org.hibernate.dialect.MySQL8Dialect + show_sql: true + format_sql: true + use_sql_comments: true + hbm2ddl: + # auto: create + auto: update + default_batch_fetch_size: 1000 springdoc: swagger-ui: