Skip to content

Commit

Permalink
Mark CouchbaseAnnotationProcessor for auto-discovery. (#1871)
Browse files Browse the repository at this point in the history
Closes #1870
  • Loading branch information
babltiga authored and mikereiche committed Jan 18, 2024
1 parent b5dc1a2 commit 8b87abb
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 26 deletions.
57 changes: 31 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<springdata.commons>3.0.13-SNAPSHOT</springdata.commons>
<java-module-name>spring.data.couchbase</java-module-name>
<hibernate.validator>7.0.1.Final</hibernate.validator>
<apt>1.1.3</apt>
<querydsl>5.0.0</querydsl>
<mysema.querydsl>3.7.4</mysema.querydsl>
<couchbase.encryption>3.1.0</couchbase.encryption>
<jodatime>2.10.13</jodatime>
Expand Down Expand Up @@ -249,6 +247,37 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl}</version>
</dependency>
</dependencies>
<configuration>
<proc>none</proc>
</configuration>
<executions>
<execution>
<id>test-annotation-processing</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<proc>only</proc>
<annotationProcessors>
<annotationProcessor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</annotationProcessor>
</annotationProcessors>
<generatedTestSourcesDirectory>target/generated-test-sources</generatedTestSourcesDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -292,30 +321,6 @@
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>${apt}</version>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-test-sources</phase>
<goals>
<goal>test-process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-test-sources</outputDirectory>
<processor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
45 changes: 45 additions & 0 deletions src/main/asciidoc/repository.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,51 @@ public class Config extends AbstractCouchbaseConfiguration {

An advanced usage is described in <<couchbase.repository.multibucket>>.

[[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.

.Maven Configuration Example
====
[source,xml]
----
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>[compiler-plugin-version]</version>
<configuration>
<annotationProcessorPaths>
<!-- path to the annotation processor -->
<path>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>[version]</version>
</path>
<path>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-couchbase</artifactId>
<version>[version]</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
----
====

.Gradle Configuration Example
====
[source,groovy]
----
annotationProcessor 'com.querydsl:querydsl-apt:${querydslVersion}'
annotationProcessor 'org.springframework.data:spring-data-couchbase:${springDataCouchbaseVersion}'
----
====

[[couchbase.repository.usage]]
== Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor

0 comments on commit 8b87abb

Please sign in to comment.