spring-bootquerydsl

Spring boot 3 with queryDSL


How i can to generate Q-classes using queryDSL with Spring Boot 3.0.

part of build.gradle:

plugins {
   id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
}

configurations {
   querydsl.extendsFrom implementation, compileOnly, runtimeOnly, annotationProcessor
}

dependencies {
   implementation 'org.springframework.boot:spring-boot-starter'
   implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
   implementation 'com.querydsl:querydsl-jpa'

   annotationProcessor 'com.querydsl:querydsl-apt'

   testImplementation 'org.springframework.boot:spring-boot-starter-test'
   testImplementation 'org.testcontainers:postgresql'

   runtimeOnly 'org.postgresql:postgresql'

}

querydsl {
   jpa = true
   library = 'com.querydsl:querydsl-apt:5.0.0'
   querydslSourcesDir = "$buildDir/generated/sources/annotationProcessor/java/main"
}

compileQuerydsl {
   options.annotationProcessorPath = configurations.querydsl
}

I try to create Q-classes by own hands, but it's doesn't work(


Solution

  • I recevied the same error upgrading to Spring Boot 3.

    I followed the small hint from QueryDSL release notes: http://querydsl.com/releases.html https://github.com/querydsl/querydsl/issues/2612

    And I replaced in my build.gradle:

    api 'com.querydsl:querydsl-jpa' -> api 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
    

    and

    annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jpa' -> annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'