Skip to content

Instantly share code, notes, and snippets.

@haipham22
Created May 30, 2022 08:50
Show Gist options
  • Save haipham22/d21c6d1688b9e620be9c808506e57cfe to your computer and use it in GitHub Desktop.
Save haipham22/d21c6d1688b9e620be9c808506e57cfe to your computer and use it in GitHub Desktop.
Springboot JPA + Gradle + Querydsl
buildscript {
ext {
queryDslVersion = '5.0.0'
}
}
plugins {
...
}
compileJava {
options.annotationProcessorPath = configurations.annotationProcessor
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencies {
...
//QueryDSL
implementation "com.querydsl:querydsl-core:${queryDslVersion}"
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa"
annotationProcessor "javax.annotation:javax.annotation-api"
annotationProcessor "org.springframework.boot:spring-boot-starter-data-jpa" // needed because the query dsl annotation processor doesn't recognize javax.persistence.Entity
}
@QueryEntities(value = {AnyEntity.class})
package xyz.abc.module.entity;
import com.querydsl.core.annotations.QueryEntities;
import xyz.abc.core.entity.AnyEntity;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment