밑에꺼 다 안됨.
- Qclass가 계속 생성이안돼서 미치는줄 알았다.
- 이유가 kapt 버전이 중요한듯
1.8.21
로 했더니 됐다. ㅠㅠ
plugins{
kotlin("kapt") version "1.8.21"
}
dependencies {
// QueryDSL
implementation("com.querydsl:querydsl-jpa:5.0.0:jakarta")
kapt("com.querydsl:querydsl-apt:5.0.0:jakarta")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
build.gradle.kts 설정
plugins {
id("idea")
kotlin("kapt") version "1.7.10"
}
dependencies {
implementation("com.querydsl:querydsl-jpa:5.0.0")
implementation("com.querydsl:querydsl-apt:5.0.0")
implementation("javax.annotation:javax.annotation-api:1.3.2")
implementation("javax.persistence:javax.persistence-api:2.2")
annotationProcessor(group = "com.querydsl", name = "querydsl-apt", classifier = "jpa")
kapt("com.querydsl:querydsl-apt:5.0.0:jpa")
}
kotlin.sourceSets.main {
println("kotlin sourceSets builDir:: $buildDir")
setBuildDir("$buildDir")
}
idea {
module {
val kaptMain = file("build/generated/source/kapt/main")
sourceDirs.add(kaptMain)
generatedSourceDirs.add(kaptMain)
}
}
QuerydslConfiguration 설정
import com.querydsl.jpa.impl.JPAQueryFactory
import javax.persistence.EntityManager
import javax.persistence.PersistenceContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class QuerydslConfiguration (
@PersistenceContext
private val entityManager: EntityManager
) {
@Bean
fun jpaQueryFactory(): JPAQueryFactory = JPAQueryFactory(entityManager) }
감사합니다~! 저도 성공했어요~!!!