dependencies {
// Spring Boot Core
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
// Kotlin
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
// Redis
implementation("org.springframework.boot:spring-boot-starter-data-redis")
// Validation
implementation("org.springframework.boot:spring-boot-starter-validation")
// Development tools
developmentOnly("org.springframework.boot:spring-boot-devtools")
// Database
runtimeOnly("org.postgresql:postgresql")
// Testing
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.springframework.security:spring-security-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
}
implementation("org.springframework.boot:spring-boot-starter-web")implementation("org.springframework.boot:spring-boot-starter-data-jpa")implementation("org.springframework.boot:spring-boot-starter-security")developmentOnly("org.springframework.boot:spring-boot-devtools")implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")implementation("org.jetbrains.kotlin:kotlin-reflect")implementation("com.fasterxml.jackson.module:jackson-module-kotlin")implementation("org.postgresql:postgresql")implementation("org.springframework.boot:spring-boot-starter-data-redis")implementation("io.jsonwebtoken:jjwt-api:$jwtVersion")implementation("io.jsonwebtoken:jjwt-impl:$jwtVersion")implementation("io.jsonwebtoken:jjwt-jackson:$jwtVersion")testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")testImplementation("io.kotest.extensions:kotest-extensions-spring:$kotestVersion")testImplementation("io.kotest:kotest-property:$kotestVersion")testImplementation("io.mockk:mockk")implementation("org.springframework.boot:spring-boot-starter-validation")implementation("org.springdoc:springdoc-openapi-ui:1.5.10")의존성의 사용 시점에 따라 나뉨.
프로젝트에서 특정 라이브러리가 어떤 단계에서 필요한지를 명확히 하여, 불필요한 라이브러리들이 잘못된 시점에 포함되는 것을 방지하는 역할이다.
패키지를 기능별로 나누어 설계하는 것이 유지보수와 확장성에 좋다.
com
└── test
├── config // 설정 관련 클래스 (Security, CORS, etc.)
├── controller // REST API 컨트롤러 (Controller 계층)
├── dto // 데이터 전송 객체 (Data Transfer Object)
├── entity // JPA 엔티티 클래스 (데이터베이스 테이블 매핑)
├── repository // 데이터베이스 액세스 레이어 (JPA Repository)
├── service // 비즈니스 로직 계층 (Service 계층)
├── exception // 예외 처리 관련 클래스
└── security // JWT, 인증/인가 관련 클래스
PostgreSQL 데이터베이스와 연결하려면, application.yml 또는 application.properties 파일에 데이터베이스 연결 정보를 추가해야 한다.
spring.datasource.url=jdbc:postgresql://localhost:5432/your_database_name
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
CI/CD 파이프라인 구축