Skip to content

Commit

Permalink
Merge pull request #24 from ClothingStoreService/feature/build-depend…
Browse files Browse the repository at this point in the history
…ency-add

feat: querydsl, mockk, kotest 빌드 추가
  • Loading branch information
hjj4060 authored Aug 15, 2024
2 parents b2b8b89 + 660042e commit add470f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 54 deletions.
63 changes: 9 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id("org.springframework.boot") version "3.3.2"
id("io.spring.dependency-management") version "1.1.6"
id("org.jetbrains.kotlin.kapt") version "1.9.24"
kotlin("jvm") version "1.9.24"
// kotlin("kapt") version "1.9.24"
kotlin("plugin.spring") version "1.9.24"
kotlin("plugin.jpa") version "1.9.24" //Entity의 기본생성자를 자동으로 만들어줌
}
Expand Down Expand Up @@ -53,72 +53,27 @@ dependencies {
runtimeOnly("com.mysql:mysql-connector-j")
runtimeOnly("com.h2database:h2")

//querydsl
//참고 URL : https://velog.io/@yangwon-park/Kotlin-Querydsl-%EC%84%B8%ED%8C%85
// implementation("com.querydsl:querydsl-jpa:5.0.0:jakarta")
// implementation("com.querydsl:querydsl-apt:5.0.0:jakarta")
// implementation("jakarta.persistence:jakarta.persistence-api")
// implementation("jakarta.annotation:jakarta.annotation-api")
// kapt("com.querydsl:querydsl-apt:5.0.0:jakarta")
// kapt("org.springframework.boot:spring-boot-configuration-processor")
//Querydsl
implementation("com.querydsl:querydsl-jpa:5.0.0:jakarta")
kapt("com.querydsl:querydsl-apt:5.0.0:jakarta")
kapt("org.springframework.boot:spring-boot-configuration-processor")

//test
val mockKVersion = "1.13.12"
val kotestVersion = "5.8.0"
val mockkVersion = "1.13.12"
val kotestVersion = "5.8"
testImplementation("io.mockk:mockk:${mockkVersion}")
testImplementation("io.kotest:kotest-runner-junit5:${kotestVersion}")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("io.mockk:mockk:${mockKVersion}")
testImplementation("io.kotest:kotest-runner-junit5:${kotestVersion}")

//etc
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0") //swagger
implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5") //암호화
implementation("org.springframework.boot:spring-boot-starter-mail") //mail 전송
implementation("org.springframework.boot:spring-boot-starter-data-redis") //redis
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

}

/**
* Query DSL 설정 참고
* URL : https://velog.io/@hana0627/Kotlin-SpringBoot3-QueryDsl-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0
*/

// Querydsl 설정부 추가 - start
//val generated = file("src/main/generated")
//
//// querydsl QClass 파일 생성 위치를 지정
//tasks.withType<JavaCompile> {
// options.generatedSourceOutputDirectory.set(generated)
//}
//
//// kotlin source set 에 querydsl QClass 위치 추가
//sourceSets {
// main {
// kotlin.srcDirs += generated
// }
//}
//
//// gradle clean 시에 QClass 디렉토리 삭제
//tasks.named("clean") {
// doLast {
// generated.deleteRecursively()
// }
//}
//
//
//kapt {
// generateStubs = true
//}
//
//// Querydsl 설정부 추가 - end
//
//kotlin {
// compilerOptions {
// freeCompilerArgs.addAll("-Xjsr305=strict")
// }
//}

tasks.withType<Test> {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.store.clothstar.common.config

import com.querydsl.jpa.impl.JPAQueryFactory
import jakarta.persistence.EntityManager
import jakarta.persistence.PersistenceContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
class JpaQueryFactoryConfig {

@PersistenceContext
private lateinit var entityManager: EntityManager

@Bean
fun jpaQueryFactory() = JPAQueryFactory(entityManager)
}

0 comments on commit add470f

Please sign in to comment.