Skip to content

Commit

Permalink
Chore: Springboot web, jpa, lombok 의존성 추가 (#7)
Browse files Browse the repository at this point in the history
* Chore: DB 연결 정보를 application.yml에 추가

* Chore: web, jpa, postgresql, lombok 의존성 추가

* Chore: env example 파일 추가

* Chore: testcontainers 테스트 환경 설정 추가
  • Loading branch information
Jaewon-pro authored Jul 21, 2024
1 parent c068a7d commit 4840943
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ out/

**/resources/.env
**/resources/.env.*
!**/resources/.env.example
17 changes: 17 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ repositories {

dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.postgresql:postgresql:42.7.3")
implementation("me.paulschwarz:spring-dotenv:4.0.0")

// Lombok
annotationProcessor("org.projectlombok:lombok:1.18.34")
testCompileOnly("org.projectlombok:lombok:1.18.34")
testAnnotationProcessor("org.projectlombok:lombok:1.18.34")

// testcontainers
testImplementation("org.testcontainers:testcontainers:1.20.0")
testImplementation("org.testcontainers:junit-jupiter:1.20.0")
testImplementation("org.testcontainers:jdbc:1.20.0")
testImplementation("org.testcontainers:postgresql:1.20.0")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATABASE_HOST=
DATABASE_PORT=
DATABASE_NAME=
DATABASE_USER=
DATABASE_PASSWORD=
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
spring.application.name: run-us

spring:
jpa:
hibernate:
ddl-auto: none
show-sql: true
open-in-view: false

datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
username: ${DATABASE_USER}
password: ${DATABASE_PASSWORD}

---
spring.config.activate.on-profile: local

spring:
jpa:
hibernate:
ddl-auto: update

---
spring.config.activate.on-profile: prod
11 changes: 11 additions & 0 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spring:
jpa:
hibernate:
ddl-auto: create
show-sql: true
open-in-view: false
defer-datasource-initialization: true

datasource:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
url: jdbc:tc:postgresql:16.3://test

0 comments on commit 4840943

Please sign in to comment.