From c89100e8c7841133f75e9378e3a1fb6c13acb89c Mon Sep 17 00:00:00 2001 From: mikereiche Date: Thu, 17 Oct 2024 14:27:38 -0700 Subject: [PATCH] Update QueryDSL doc. Closes #1993. --- .../ROOT/pages/couchbase/repository.adoc | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/couchbase/repository.adoc b/src/main/antora/modules/ROOT/pages/couchbase/repository.adoc index ede1221ba..df8a32df2 100644 --- a/src/main/antora/modules/ROOT/pages/couchbase/repository.adoc +++ b/src/main/antora/modules/ROOT/pages/couchbase/repository.adoc @@ -33,33 +33,47 @@ An advanced usage is described in <>. [[couchbase.repository.configuration.dsl]] === QueryDSL Configuration -Spring Data Couchbase supports QueryDSL for building type-safe queries. To enable code generation you need to set `spring-data-couchbase` as annotation processor on your project. +Spring Data Couchbase supports QueryDSL for building type-safe queries. To enable code generation, setting `CouchbaseAnnotationProcessor` as an annotation processor is required. +Additionally, the runtime needs querydsl-apt to enable QueryDSL on repositories. .Maven Configuration Example ==== [source,xml] ---- + . existing depdendencies including those required for spring-data-couchbase + . + . + + com.querydsl + querydsl-apt + ${querydslVersion} + + + org.apache.maven.plugins maven-compiler-plugin - [compiler-plugin-version] - - - - - com.querydsl - querydsl-apt - [version] - - - org.springframework.data - spring-data-couchbase - [version] - - - + + + annotation-processing + generate-sources + + compile + + + only + + org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor + + target/generated-sources + + -Aquerydsl.logInfo=true + + + + @@ -69,10 +83,19 @@ Spring Data Couchbase supports QueryDSL for building type-safe queries. To enabl .Gradle Configuration Example ==== -[source,groovy] +[source,groovy,indent=0,subs="verbatim,quotes",role="secondary"] ---- -annotationProcessor 'com.querydsl:querydsl-apt:${querydslVersion}' -annotationProcessor 'org.springframework.data:spring-data-couchbase:${springDataCouchbaseVersion}' +dependencies { + annotationProcessor 'com.querydsl:querydsl-apt:${querydslVersion}' + annotationProcessor 'org.springframework.data:spring-data-couchbase' + testAnnotationProcessor 'com.querydsl:querydsl-apt:${querydslVersion}' + testAnnotationProcessor 'org.springframework.data:spring-data-couchbase' +} +tasks.withType(JavaCompile).configureEach { + options.compilerArgs += [ + "-processor", + "org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor"] +} ---- ====