diff --git a/.gitignore b/.gitignore
index 6cffbf02..9d87652f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,6 @@ target/
/.idea/
node_modules
node
-package.json
package-lock.json
build/
-.mvn/.gradle-enterprise
+.mvn/.develocity
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index ebd76102..e0857eaa 100644
--- a/.mvn/extensions.xml
+++ b/.mvn/extensions.xml
@@ -1,13 +1,8 @@
- com.gradle
- gradle-enterprise-maven-extension
- 1.19.2
-
-
- com.gradle
- common-custom-user-data-maven-extension
- 1.12.4
+ io.spring.develocity.conventions
+ develocity-conventions-maven-extension
+ 0.0.22
diff --git a/.mvn/gradle-enterprise.xml b/.mvn/gradle-enterprise.xml
deleted file mode 100644
index c2440631..00000000
--- a/.mvn/gradle-enterprise.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- https://ge.spring.io
-
-
- false
- true
- true
-
- #{{'0.0.0.0'}}
-
-
-
-
- true
-
-
-
-
- ${env.DEVELOCITY_CACHE_USERNAME}
- ${env.DEVELOCITY_CACHE_PASSWORD}
-
-
- true
- #{env['DEVELOCITY_CACHE_USERNAME'] != null and env['DEVELOCITY_CACHE_PASSWORD'] != null}
-
-
-
diff --git a/.mvn/jvm.config b/.mvn/jvm.config
new file mode 100644
index 00000000..e27f6e8f
--- /dev/null
+++ b/.mvn/jvm.config
@@ -0,0 +1,14 @@
+--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
+--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
+--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
+--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
+--add-opens=java.base/java.util=ALL-UNNAMED
+--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
+--add-opens=java.base/java.text=ALL-UNNAMED
+--add-opens=java.desktop/java.awt.font=ALL-UNNAMED
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 3a8538ed..4b8c22d8 100755
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1,2 +1,2 @@
-#Thu Dec 14 08:40:34 CET 2023
-distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
+#Thu Nov 07 09:48:02 CET 2024
+distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/Jenkinsfile b/Jenkinsfile
index 0b26a666..e5ef5176 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -9,7 +9,7 @@ pipeline {
triggers {
pollSCM 'H/10 * * * *'
- upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS)
+ upstream(upstreamProjects: "spring-data-commons/3.3.x", threshold: hudson.model.Result.SUCCESS)
}
options {
@@ -32,17 +32,15 @@ pipeline {
options { timeout(time: 30, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
- DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
- docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
- sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
- 'DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} ' +
- 'DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} ' +
- 'GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} ' +
- './mvnw -s settings.xml clean dependency:list test -Dsort -U -B'
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
+ sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
+ './mvnw -s settings.xml -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-keyvalue clean dependency:list test -Dsort -U -B'
+ }
}
}
}
@@ -64,17 +62,15 @@ pipeline {
options { timeout(time: 30, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
- DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
- docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.basic']) {
- sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
- 'DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} ' +
- 'DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} ' +
- 'GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} ' +
- './mvnw -s settings.xml clean dependency:list test -Dsort -U -B'
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
+ sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
+ './mvnw -s settings.xml -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-keyvalue clean dependency:list test -Dsort -U -B'
+ }
}
}
}
@@ -96,24 +92,24 @@ pipeline {
options { timeout(time: 20, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
- DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
- docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
- sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
- 'DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} ' +
- 'DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} ' +
- 'GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} ' +
- "./mvnw -s settings.xml -Pci,artifactory " +
- "-Dartifactory.server=${p['artifactory.url']} " +
- "-Dartifactory.username=${ARTIFACTORY_USR} " +
- "-Dartifactory.password=${ARTIFACTORY_PSW} " +
- "-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
- "-Dartifactory.build-name=spring-data-keyvalue " +
- "-Dartifactory.build-number=spring-data-keyvalue-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
- '-Dmaven.test.skip=true clean deploy -U -B'
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
+ sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
+ "./mvnw -s settings.xml -Pci,artifactory " +
+ "-Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root " +
+ "-Dartifactory.server=${p['artifactory.url']} " +
+ "-Dartifactory.username=${ARTIFACTORY_USR} " +
+ "-Dartifactory.password=${ARTIFACTORY_PSW} " +
+ "-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
+ "-Dartifactory.build-name=spring-data-keyvalue " +
+ "-Dartifactory.build-number=spring-data-keyvalue-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
+ "-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-keyvalue " +
+ '-Dmaven.test.skip=true clean deploy -U -B'
+ }
}
}
}
@@ -123,10 +119,6 @@ pipeline {
post {
changed {
script {
- slackSend(
- color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
- channel: '#spring-data-dev',
- message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}")
emailext(
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
mimeType: 'text/html',
diff --git a/ci/pipeline.properties b/ci/pipeline.properties
index 60057f26..81d1e290 100644
--- a/ci/pipeline.properties
+++ b/ci/pipeline.properties
@@ -1,10 +1,10 @@
# Java versions
-java.main.tag=17.0.9_9-jdk-focal
-java.next.tag=21.0.1_12-jdk-jammy
+java.main.tag=17.0.15_6-jdk-focal
+java.next.tag=22.0.2_9-jdk-jammy
# Docker container images - standard
-docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
-docker.java.next.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.next.tag}
+docker.java.main.image=library/eclipse-temurin:${java.main.tag}
+docker.java.next.image=library/eclipse-temurin:${java.next.tag}
# Supported versions of MongoDB
docker.mongodb.4.4.version=4.4.25
@@ -14,6 +14,7 @@ docker.mongodb.7.0.version=7.0.2
# Supported versions of Redis
docker.redis.6.version=6.2.13
+docker.redis.7.version=7.2.4
# Supported versions of Cassandra
docker.cassandra.3.version=3.11.16
@@ -25,9 +26,10 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
# Credentials
docker.registry=
docker.credentials=hub.docker.com-springbuildmaster
+docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com
+docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
artifactory.url=https://repo.spring.io
artifactory.repository.snapshot=libs-snapshot-local
-develocity.cache.credentials=gradle_enterprise_cache_user
develocity.access-key=gradle_enterprise_secret_access_key
jenkins.user.name=spring-builds+jenkins
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..057a40fe
--- /dev/null
+++ b/package.json
@@ -0,0 +1,10 @@
+{
+ "dependencies": {
+ "antora": "3.2.0-alpha.6",
+ "@antora/atlas-extension": "1.0.0-alpha.2",
+ "@antora/collector-extension": "1.0.0-alpha.7",
+ "@asciidoctor/tabs": "1.0.0-beta.6",
+ "@springio/antora-extensions": "1.13.0",
+ "@springio/asciidoctor-extensions": "1.0.0-alpha.11"
+ }
+}
diff --git a/pom.xml b/pom.xml
index 2f789c17..1ad6ff9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,19 +5,19 @@
org.springframework.dataspring-data-keyvalue
- 3.3.0
+ 3.3.14-SNAPSHOTSpring Data KeyValueorg.springframework.data.buildspring-data-parent
- 3.3.0
+ 3.3.14-SNAPSHOT
- 3.3.0
+ 3.3.14-SNAPSHOTspring.data.keyvalue
@@ -99,7 +99,7 @@
- io.spring.maven.antora
+ org.antoraantora-maven-plugin
@@ -108,8 +108,20 @@
-
-
+
+ spring-snapshot
+ https://repo.spring.io/snapshot
+
+ true
+
+
+ false
+
+
+
+ spring-milestone
+ https://repo.spring.io/milestone
+
diff --git a/src/main/antora/antora-playbook.yml b/src/main/antora/antora-playbook.yml
index 82d3d161..619cdaf5 100644
--- a/src/main/antora/antora-playbook.yml
+++ b/src/main/antora/antora-playbook.yml
@@ -3,8 +3,7 @@
# The purpose of this Antora playbook is to build the docs in the current branch.
antora:
extensions:
- - '@antora/collector-extension'
- - require: '@springio/antora-extensions/root-component-extension'
+ - require: '@springio/antora-extensions'
root_component_name: 'data-keyvalue'
site:
title: Spring Data KeyValue
@@ -22,13 +21,12 @@ content:
start_path: src/main/antora
asciidoc:
attributes:
- page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
- chomp: 'all'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
+ - '@springio/asciidoctor-extensions/javadoc-extension'
sourcemap: true
urls:
latest_version_segment: ''
@@ -38,5 +36,5 @@ runtime:
format: pretty
ui:
bundle:
- url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
+ url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
snapshot: true
diff --git a/src/main/antora/antora.yml b/src/main/antora/antora.yml
index 23deed7c..5f92dc16 100644
--- a/src/main/antora/antora.yml
+++ b/src/main/antora/antora.yml
@@ -10,3 +10,8 @@ ext:
local: true
scan:
dir: target/classes/
+ - run:
+ command: ./mvnw package -Pdistribute
+ local: true
+ scan:
+ dir: target/antora
diff --git a/src/main/antora/modules/ROOT/nav.adoc b/src/main/antora/modules/ROOT/nav.adoc
index 3b315c3d..0f5bc8c9 100644
--- a/src/main/antora/modules/ROOT/nav.adoc
+++ b/src/main/antora/modules/ROOT/nav.adoc
@@ -10,4 +10,6 @@
** xref:repositories/query-keywords-reference.adoc[]
** xref:repositories/query-return-types-reference.adoc[]
-* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
+* xref:attachment$api/java/index.html[Javadoc,role=link-external,window=_blank]
+* https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external,window=_blank]
+
diff --git a/src/main/antora/modules/ROOT/pages/keyvalue/repository/map-repositories.adoc b/src/main/antora/modules/ROOT/pages/keyvalue/repository/map-repositories.adoc
index 1fe31017..56c3c40f 100644
--- a/src/main/antora/modules/ROOT/pages/keyvalue/repository/map-repositories.adoc
+++ b/src/main/antora/modules/ROOT/pages/keyvalue/repository/map-repositories.adoc
@@ -2,7 +2,7 @@
= Map Repositories
Map repositories reside on top of the `KeyValueTemplate`.
-Using the default `SpelQueryCreator` allows deriving query and sort expressions from the given method name, as the following example shows:
+Using the default `PredicateQueryCreator` allows deriving query and sort expressions from the given method name, as the following example shows:
[source, java]
----
@@ -16,3 +16,10 @@ interface PersonRepository implements CrudRepository {
List findByLastname(String lastname);
}
----
+
+== Configuring the QueryEngine
+
+It is possible to change the `QueryEngine` and use a custom one instead of the default.
+The `EnableMapRepositories` annotation allows to configure the by supplying a `QueryEngineFactory` as well as the `QueryCreator` via according attributes.
+Please mind that the `QueryEngine` needs to be able to process queries created by the configured `QueryCreator`.
+
diff --git a/src/main/java/org/springframework/data/keyvalue/annotation/KeySpace.java b/src/main/java/org/springframework/data/keyvalue/annotation/KeySpace.java
index 89f200a9..4f38df38 100644
--- a/src/main/java/org/springframework/data/keyvalue/annotation/KeySpace.java
+++ b/src/main/java/org/springframework/data/keyvalue/annotation/KeySpace.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/aot/KeyValueRuntimeHints.java b/src/main/java/org/springframework/data/keyvalue/aot/KeyValueRuntimeHints.java
index 3b0fd1a1..cdfa4496 100644
--- a/src/main/java/org/springframework/data/keyvalue/aot/KeyValueRuntimeHints.java
+++ b/src/main/java/org/springframework/data/keyvalue/aot/KeyValueRuntimeHints.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 the original author or authors.
+ * Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java b/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
index 7459a61a..80868a88 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/CriteriaAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/CriteriaAccessor.java
index 11f59485..d50c6268 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/CriteriaAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/CriteriaAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java b/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java
index d21f2539..ffa59dfa 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java b/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java
index 33f6c12d..3867d74f 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java
index 03a6825d..46a07ac2 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/IdentifierGenerator.java b/src/main/java/org/springframework/data/keyvalue/core/IdentifierGenerator.java
index 9e6f901e..c77119be 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/IdentifierGenerator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/IdentifierGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/IterableConverter.java b/src/main/java/org/springframework/data/keyvalue/core/IterableConverter.java
index 7ac87e05..23527ebd 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/IterableConverter.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/IterableConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
index cf415612..f3eaf1d1 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueCallback.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueCallback.java
index 73ad5626..97328498 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueCallback.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
index f70180cf..4caa2a09 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java
index ad0e0b88..3543c918 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
index 0bb0f78b..f1cd793f 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/PathSortAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/PathSortAccessor.java
index 1f02ca71..5e6bcab2 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/PathSortAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/PathSortAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/PredicateQueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/PredicateQueryEngine.java
index 9aa12bf3..8c51fe6b 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/PredicateQueryEngine.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/PredicateQueryEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
* @author Christoph Strobl
* @since 3.3
*/
-class PredicateQueryEngine extends QueryEngine, Comparator>> {
+public class PredicateQueryEngine extends QueryEngine, Comparator>> {
/**
* Creates a new {@link PredicateQueryEngine}.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/PropertyPathComparator.java b/src/main/java/org/springframework/data/keyvalue/core/PropertyPathComparator.java
index 9ad51527..dfd47031 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/PropertyPathComparator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/PropertyPathComparator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
index 2b67ea94..33b581ce 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/QueryEngineFactory.java b/src/main/java/org/springframework/data/keyvalue/core/QueryEngineFactory.java
new file mode 100644
index 00000000..6c75c026
--- /dev/null
+++ b/src/main/java/org/springframework/data/keyvalue/core/QueryEngineFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2024-2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.keyvalue.core;
+
+/**
+ * Interface for {@code QueryEngineFactory} implementations that provide a {@link QueryEngine} object as part of the
+ * configuration.
+ *
+ * The factory is used during configuration to supply the query engine to be used. When configured, a
+ * {@code QueryEngineFactory} can be instantiated by accepting a {@link SortAccessor} in its constructor. Otherwise,
+ * implementations are expected to declare a no-args constructor.
+ *
+ * @author Mark Paluch
+ * @since 3.3.1
+ */
+public interface QueryEngineFactory {
+
+ /**
+ * Factory method for creating a {@link QueryEngine}.
+ *
+ * @return the query engine.
+ */
+ QueryEngine, ?, ?> create();
+}
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SimplePropertyPathAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/SimplePropertyPathAccessor.java
index f4ae8e73..84f21a35 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SimplePropertyPathAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SimplePropertyPathAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SortAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/SortAccessor.java
index afde802a..e7c43907 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SortAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SortAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelCriteria.java b/src/main/java/org/springframework/data/keyvalue/core/SpelCriteria.java
index eb7bfcc2..bb34082d 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelCriteria.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelCriteria.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelCriteriaAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/SpelCriteriaAccessor.java
index 59d6603e..4f91aa58 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelCriteriaAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelCriteriaAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java b/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java
index 04a62200..12838553 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
index 76552899..cd8c27f5 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,9 +34,8 @@
* @author Christoph Strobl
* @author Oliver Gierke
* @author Mark Paluch
- * @param
*/
-class SpelQueryEngine extends QueryEngine> {
+public class SpelQueryEngine extends QueryEngine> {
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java
index fe9101be..c76da7c9 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/UncategorizedKeyValueException.java b/src/main/java/org/springframework/data/keyvalue/core/UncategorizedKeyValueException.java
index c453cd0b..34063948 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/UncategorizedKeyValueException.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/UncategorizedKeyValueException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java b/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
index a626bf46..bae7114f 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java
index 8465b507..004a77ac 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntity.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntity.java
index d4045fb5..a5b62b7a 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntity.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java
index e368bb64..fead1ce8 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeySpaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeySpaceResolver.java
index 5226260c..0aa54013 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeySpaceResolver.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeySpaceResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentEntity.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentEntity.java
index 607ec8d3..76ca8377 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentEntity.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentProperty.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentProperty.java
index 377a368b..2a32b1b7 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentProperty.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/KeyValuePersistentProperty.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolver.java
index 3e787ebb..3feb5f3a 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolver.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 the original author or authors.
+ * Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContext.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContext.java
index 3345b54e..41bb882e 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContext.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java
index be4c812a..d1dd1bc9 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
index bdbd9432..3fde0549 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/config/KeyValueRepositoryConfigurationExtension.java b/src/main/java/org/springframework/data/keyvalue/repository/config/KeyValueRepositoryConfigurationExtension.java
index f73eb224..9a99d099 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/config/KeyValueRepositoryConfigurationExtension.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/config/KeyValueRepositoryConfigurationExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.annotation.AnnotationAttributes;
+import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.keyvalue.repository.KeyValueRepository;
@@ -36,7 +37,6 @@
import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport;
import org.springframework.data.repository.config.RepositoryConfigurationSource;
import org.springframework.lang.Nullable;
-import org.springframework.util.CollectionUtils;
/**
* {@link RepositoryConfigurationExtension} for {@link KeyValueRepository}.
@@ -90,17 +90,15 @@ public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfi
*/
private static Class> getQueryCreatorType(AnnotationRepositoryConfigurationSource config) {
- AnnotationMetadata metadata = config.getEnableAnnotationMetadata();
+ AnnotationMetadata amd = (AnnotationMetadata) config.getSource();
+ MergedAnnotation queryCreator = amd.getAnnotations().get(QueryCreatorType.class);
+ Class> queryCreatorType = queryCreator.isPresent() ? queryCreator.getClass("value") : Class.class;
- Map queryCreatorAnnotationAttributes = metadata
- .getAnnotationAttributes(QueryCreatorType.class.getName());
-
- if (CollectionUtils.isEmpty(queryCreatorAnnotationAttributes)) {
+ if (queryCreatorType == Class.class) {
return SpelQueryCreator.class;
}
- AnnotationAttributes queryCreatorAttributes = new AnnotationAttributes(queryCreatorAnnotationAttributes);
- return queryCreatorAttributes.getClass("value");
+ return queryCreatorType;
}
/**
@@ -132,10 +130,10 @@ public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConf
registerIfNotAlreadyRegistered(() -> {
- RootBeanDefinition definitionefinition = new RootBeanDefinition(KeyValueMappingContext.class);
- definitionefinition.setSource(configurationSource.getSource());
+ RootBeanDefinition mappingContext = new RootBeanDefinition(KeyValueMappingContext.class);
+ mappingContext.setSource(configurationSource.getSource());
- return definitionefinition;
+ return mappingContext;
}, registry, getMappingContextBeanRef(), configurationSource);
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/config/QueryCreatorType.java b/src/main/java/org/springframework/data/keyvalue/repository/config/QueryCreatorType.java
index d78bee9a..44db10e3 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/config/QueryCreatorType.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/config/QueryCreatorType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQuery.java b/src/main/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQuery.java
index 94ec0f01..23f565cb 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQuery.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQuery.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java
index bffef1bd..9d783daa 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ public KeyValuePartTreeQuery(QueryMethod queryMethod, QueryMethodEvaluationConte
QueryCreatorFactory, ?>> queryCreatorFactory) {
Assert.notNull(queryMethod, "Query method must not be null");
- Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null");
+ Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null");
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null");
Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null");
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreator.java b/src/main/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreator.java
index 52076fe1..55ca24bf 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreator.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,8 @@
import org.springframework.util.comparator.NullSafeComparator;
/**
+ * {@link AbstractQueryCreator} to create {@link Predicate}-based {@link KeyValueQuery}s.
+ *
* @author Christoph Strobl
* @since 3.3
*/
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java b/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java
index e2b4cc2c..f3c075bf 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
import org.springframework.util.StringUtils;
/**
- * {@link AbstractQueryCreator} to create {@link SpelExpression} based {@link KeyValueQuery}s.
+ * {@link AbstractQueryCreator} to create {@link SpelExpression}-based {@link KeyValueQuery}s.
*
* @author Christoph Strobl
* @author Oliver Gierke
@@ -180,8 +180,8 @@ protected SpelExpression toPredicateExpression(PartTree tree) {
case NEGATING_SIMPLE_PROPERTY:
case EXISTS:
default:
- throw new InvalidDataAccessApiUsageException(String.format("Found invalid part '%s' in query",
- part.getType()));
+ throw new InvalidDataAccessApiUsageException(
+ "Found invalid part '%s' in query".formatted(part.getType()));
}
if (partIter.hasNext()) {
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtils.java b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtils.java
index 519e61bd..e2d256bd 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtils.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java
index 0fdc176d..62103a06 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java
index f80781a3..04942d83 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java
index cded2d04..46f60de4 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2024 the original author or authors.
+ * Copyright 2021-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java
index b52e3b1f..1906540c 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
index dc689398..6e94dcae 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
index 9c204e0a..ebe39ef9 100644
--- a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/map/repository/config/EnableMapRepositories.java b/src/main/java/org/springframework/data/map/repository/config/EnableMapRepositories.java
index b352f99f..b32a5139 100644
--- a/src/main/java/org/springframework/data/map/repository/config/EnableMapRepositories.java
+++ b/src/main/java/org/springframework/data/map/repository/config/EnableMapRepositories.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,16 +28,18 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Import;
+import org.springframework.core.annotation.AliasFor;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.keyvalue.core.KeyValueTemplate;
+import org.springframework.data.keyvalue.core.QueryEngineFactory;
import org.springframework.data.keyvalue.core.SortAccessor;
import org.springframework.data.keyvalue.repository.config.QueryCreatorType;
-import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery;
import org.springframework.data.keyvalue.repository.query.PredicateQueryCreator;
import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean;
import org.springframework.data.repository.config.DefaultRepositoryBaseClass;
import org.springframework.data.repository.query.QueryLookupStrategy;
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
+import org.springframework.data.repository.query.parser.AbstractQueryCreator;
/**
* Annotation to activate Map repositories. If no base package is configured through either {@link #value()},
@@ -45,13 +47,14 @@
*
* @author Christoph Strobl
* @author Oliver Gierke
+ * @author Mark Paluch
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import(MapRepositoriesRegistrar.class)
-@QueryCreatorType(value = PredicateQueryCreator.class, repositoryQueryType = KeyValuePartTreeQuery.class)
+@QueryCreatorType(PredicateQueryCreator.class)
public @interface EnableMapRepositories {
/**
@@ -145,10 +148,29 @@
@SuppressWarnings("rawtypes")
Class extends Map> mapType() default ConcurrentHashMap.class;
+ /**
+ * Configures the {@link QueryEngineFactory} to create the QueryEngine. When both, the query engine and sort accessors
+ * are configured, the query engine is instantiated using the configured sort accessor.
+ *
+ * @return {@link QueryEngineFactory} to configure the QueryEngine.
+ * @since 3.3.1
+ */
+ Class extends QueryEngineFactory> queryEngineFactory() default QueryEngineFactory.class;
+
+ /**
+ * Configures the {@code QueryCreator} to create Part-Tree queries. The QueryCreator must create queries supported by
+ * the underlying {@code QueryEngine}.
+ *
+ * @return {@link AbstractQueryCreator}
+ * @since 3.3.1
+ */
+ @AliasFor(annotation = QueryCreatorType.class, value = "value")
+ Class extends AbstractQueryCreator, ?>> queryCreator() default PredicateQueryCreator.class;
+
/**
* Configures the {@link SortAccessor accessor} for sorting results.
*
- * @return {@link SortAccessor} to indicate usage of default implementation.
+ * @return the configured {@link SortAccessor}.
* @since 3.1.10
*/
Class extends SortAccessor> sortAccessor() default SortAccessor.class;
diff --git a/src/main/java/org/springframework/data/map/repository/config/MapRepositoriesRegistrar.java b/src/main/java/org/springframework/data/map/repository/config/MapRepositoriesRegistrar.java
index 188aed2f..3097315c 100644
--- a/src/main/java/org/springframework/data/map/repository/config/MapRepositoriesRegistrar.java
+++ b/src/main/java/org/springframework/data/map/repository/config/MapRepositoriesRegistrar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/map/repository/config/MapRepositoryConfigurationExtension.java b/src/main/java/org/springframework/data/map/repository/config/MapRepositoryConfigurationExtension.java
index c8a63166..e0632a4a 100644
--- a/src/main/java/org/springframework/data/map/repository/config/MapRepositoryConfigurationExtension.java
+++ b/src/main/java/org/springframework/data/map/repository/config/MapRepositoryConfigurationExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package org.springframework.data.map.repository.config;
+import java.lang.reflect.Constructor;
import java.util.Map;
import org.springframework.beans.BeanUtils;
@@ -24,15 +25,23 @@
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.config.ParsingUtils;
import org.springframework.data.keyvalue.core.KeyValueTemplate;
+import org.springframework.data.keyvalue.core.QueryEngine;
+import org.springframework.data.keyvalue.core.QueryEngineFactory;
import org.springframework.data.keyvalue.core.SortAccessor;
import org.springframework.data.keyvalue.repository.config.KeyValueRepositoryConfigurationExtension;
import org.springframework.data.map.MapKeyValueAdapter;
+import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import org.springframework.data.repository.config.RepositoryConfigurationSource;
import org.springframework.lang.Nullable;
+import org.springframework.util.ClassUtils;
/**
+ * {@link RepositoryConfigurationExtension} for Map-based repositories.
+ *
* @author Christoph Strobl
+ * @author Mark Paluch
*/
+@SuppressWarnings("unchecked")
public class MapRepositoryConfigurationExtension extends KeyValueRepositoryConfigurationExtension {
@Override
@@ -58,7 +67,11 @@ protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition(
adapterBuilder.addConstructorArgValue(getMapTypeToUse(configurationSource));
SortAccessor> sortAccessor = getSortAccessor(configurationSource);
- if(sortAccessor != null) {
+ QueryEngine, ?, ?> queryEngine = getQueryEngine(sortAccessor, configurationSource);
+
+ if (queryEngine != null) {
+ adapterBuilder.addConstructorArgValue(queryEngine);
+ } else if (sortAccessor != null) {
adapterBuilder.addConstructorArgValue(sortAccessor);
}
@@ -73,20 +86,59 @@ protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition(
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Class extends Map> getMapTypeToUse(RepositoryConfigurationSource source) {
- return (Class extends Map>) ((AnnotationMetadata) source.getSource()).getAnnotationAttributes(
- EnableMapRepositories.class.getName()).get("mapType");
+ return (Class extends Map>) getAnnotationAttributes(source).get("mapType");
}
@Nullable
private static SortAccessor> getSortAccessor(RepositoryConfigurationSource source) {
- Class extends SortAccessor>> sortAccessorType = (Class extends SortAccessor>>) ((AnnotationMetadata) source.getSource()).getAnnotationAttributes(
- EnableMapRepositories.class.getName()).get("sortAccessor");
+ Class extends SortAccessor>> sortAccessorType = (Class extends SortAccessor>>) getAnnotationAttributes(
+ source).get("sortAccessor");
- if(sortAccessorType != null && !sortAccessorType.isInterface()) {
+ if (sortAccessorType != null && !sortAccessorType.isInterface()) {
return BeanUtils.instantiateClass(sortAccessorType);
}
return null;
}
+
+ @Nullable
+ private static QueryEngine, ?, ?> getQueryEngine(@Nullable SortAccessor> sortAccessor,
+ RepositoryConfigurationSource source) {
+
+ Class extends QueryEngineFactory> queryEngineFactoryType = (Class extends QueryEngineFactory>) getAnnotationAttributes(
+ source).get("queryEngineFactory");
+
+ if(queryEngineFactoryType == null || queryEngineFactoryType.isInterface()) {
+ return null;
+ }
+
+ if (sortAccessor != null) {
+ Constructor extends QueryEngineFactory> constructor = ClassUtils
+ .getConstructorIfAvailable(queryEngineFactoryType, SortAccessor.class);
+ if (constructor != null) {
+ return BeanUtils.instantiateClass(constructor, sortAccessor).create();
+ }
+ }
+
+ return BeanUtils.instantiateClass(queryEngineFactoryType).create();
+ }
+
+ private static Map getAnnotationAttributes(RepositoryConfigurationSource source) {
+
+ AnnotationMetadata annotationSource = (AnnotationMetadata) source.getSource();
+
+ if (annotationSource == null) {
+ throw new IllegalArgumentException("AnnotationSource not available");
+ }
+
+ Map annotationAttributes = annotationSource
+ .getAnnotationAttributes(EnableMapRepositories.class.getName());
+
+ if (annotationAttributes == null) {
+ throw new IllegalStateException("No annotation attributes for @EnableMapRepositories");
+ }
+
+ return annotationAttributes;
+ }
}
diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt
index 0fbf92e9..04cc763e 100644
--- a/src/main/resources/notice.txt
+++ b/src/main/resources/notice.txt
@@ -1,4 +1,4 @@
-Spring Data KeyValue 3.3 GA (2024.0.0)
+Spring Data KeyValue 3.3.13 (2024.0.13)
Copyright (c) 2015-2019 Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0
@@ -42,6 +42,19 @@ subcomponent's license, as noted in the license.txt file.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/org/springframework/data/keyvalue/CustomKeySpaceAnnotationWithAliasFor.java b/src/test/java/org/springframework/data/keyvalue/CustomKeySpaceAnnotationWithAliasFor.java
index 27b6fdfc..93873cb0 100644
--- a/src/test/java/org/springframework/data/keyvalue/CustomKeySpaceAnnotationWithAliasFor.java
+++ b/src/test/java/org/springframework/data/keyvalue/CustomKeySpaceAnnotationWithAliasFor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/Person.java b/src/test/java/org/springframework/data/keyvalue/Person.java
index 6538af6d..342e5197 100644
--- a/src/test/java/org/springframework/data/keyvalue/Person.java
+++ b/src/test/java/org/springframework/data/keyvalue/Person.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/SubclassOfTypeWithCustomComposedKeySpaceAnnotation.java b/src/test/java/org/springframework/data/keyvalue/SubclassOfTypeWithCustomComposedKeySpaceAnnotation.java
index c7fa4386..6b192900 100644
--- a/src/test/java/org/springframework/data/keyvalue/SubclassOfTypeWithCustomComposedKeySpaceAnnotation.java
+++ b/src/test/java/org/springframework/data/keyvalue/SubclassOfTypeWithCustomComposedKeySpaceAnnotation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/TypeWithCustomComposedKeySpaceAnnotationUsingAliasFor.java b/src/test/java/org/springframework/data/keyvalue/TypeWithCustomComposedKeySpaceAnnotationUsingAliasFor.java
index 87275481..5aff120e 100644
--- a/src/test/java/org/springframework/data/keyvalue/TypeWithCustomComposedKeySpaceAnnotationUsingAliasFor.java
+++ b/src/test/java/org/springframework/data/keyvalue/TypeWithCustomComposedKeySpaceAnnotationUsingAliasFor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/TypeWithDirectKeySpaceAnnotation.java b/src/test/java/org/springframework/data/keyvalue/TypeWithDirectKeySpaceAnnotation.java
index 154c44e2..9a9470cc 100644
--- a/src/test/java/org/springframework/data/keyvalue/TypeWithDirectKeySpaceAnnotation.java
+++ b/src/test/java/org/springframework/data/keyvalue/TypeWithDirectKeySpaceAnnotation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/TypeWithInhteritedPersistentAnnotationNotHavingKeySpace.java b/src/test/java/org/springframework/data/keyvalue/TypeWithInhteritedPersistentAnnotationNotHavingKeySpace.java
index 636ba911..38d39e58 100644
--- a/src/test/java/org/springframework/data/keyvalue/TypeWithInhteritedPersistentAnnotationNotHavingKeySpace.java
+++ b/src/test/java/org/springframework/data/keyvalue/TypeWithInhteritedPersistentAnnotationNotHavingKeySpace.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/TypeWithPersistentAnnotationNotHavingKeySpace.java b/src/test/java/org/springframework/data/keyvalue/TypeWithPersistentAnnotationNotHavingKeySpace.java
index abf33017..88929ec1 100644
--- a/src/test/java/org/springframework/data/keyvalue/TypeWithPersistentAnnotationNotHavingKeySpace.java
+++ b/src/test/java/org/springframework/data/keyvalue/TypeWithPersistentAnnotationNotHavingKeySpace.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/DefaultIdentifierGeneratorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/DefaultIdentifierGeneratorUnitTests.java
index f9522748..95872aca 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/DefaultIdentifierGeneratorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/DefaultIdentifierGeneratorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/ForwardingCloseableIteratorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/ForwardingCloseableIteratorUnitTests.java
index 98581202..1a434b56 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/ForwardingCloseableIteratorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/ForwardingCloseableIteratorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/IterableConverterUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/IterableConverterUnitTests.java
index 2a410853..c32a688e 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/IterableConverterUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/IterableConverterUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslatorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslatorUnitTests.java
index 7dd573c7..f57a2e08 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslatorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslatorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateTests.java b/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateTests.java
index 234a2430..4967357f 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateUnitTests.java
index ef6012c6..6953e959 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/KeyValueTemplateUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/PredicateQueryEngineUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/PredicateQueryEngineUnitTests.java
index eb3c0711..8c1ac0c5 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/PredicateQueryEngineUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/PredicateQueryEngineUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/PropertyPathComparatorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/PropertyPathComparatorUnitTests.java
index d5df69ad..cd5fa097 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/PropertyPathComparatorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/PropertyPathComparatorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/SpelPropertyComperatorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/SpelPropertyComperatorUnitTests.java
index 75799e7b..e56d919c 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/SpelPropertyComperatorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/SpelPropertyComperatorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/SpelQueryEngineUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/SpelQueryEngineUnitTests.java
index 5aa31dac..fa374dc8 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/SpelQueryEngineUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/SpelQueryEngineUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolverUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolverUnitTests.java
index 8f75d52f..e7abfb75 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolverUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolverUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntityUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntityUnitTests.java
index 6cafc35d..5fad73e9 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntityUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/mapping/BasicKeyValuePersistentEntityUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2024 the original author or authors.
+ * Copyright 2019-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolverUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolverUnitTests.java
index 5353476b..ccbe9477 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolverUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/mapping/PrefixKeyspaceResolverUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2024 the original author or authors.
+ * Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContextUnitTests.java b/src/test/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContextUnitTests.java
index 08ad53be..a0afb945 100644
--- a/src/test/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContextUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/core/mapping/context/KeyValueMappingContextUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2024 the original author or authors.
+ * Copyright 2021-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/SimpleKeyValueRepositoryUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/SimpleKeyValueRepositoryUnitTests.java
index 46f7284d..2ead2c5d 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/SimpleKeyValueRepositoryUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/SimpleKeyValueRepositoryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/AbstractQueryCreatorTestBase.java b/src/test/java/org/springframework/data/keyvalue/repository/query/AbstractQueryCreatorTestBase.java
index 1d11e468..2b4b50d7 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/query/AbstractQueryCreatorTestBase.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/query/AbstractQueryCreatorTestBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java
index 23bbc165..1426a33d 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQueryUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQueryUnitTests.java
index b4f85d55..60aab857 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQueryUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQueryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2024 the original author or authors.
+ * Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreatorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreatorUnitTests.java
index 6113c751..2f5449ec 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreatorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/query/PredicateQueryCreatorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreatorUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreatorUnitTests.java
index 9ddc54ce..8134bd55 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreatorUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreatorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtilsUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtilsUnitTests.java
index ee38f1f7..6a3164fb 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtilsUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueQuerydslUtilsUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBeanUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBeanUnitTests.java
index 3a4545c1..e437423a 100644
--- a/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBeanUnitTests.java
+++ b/src/test/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBeanUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java b/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java
index af7e41e1..bdc60947 100644
--- a/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java
+++ b/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java b/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java
index a0812cf1..eb74c1c9 100644
--- a/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java
+++ b/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2024 the original author or authors.
+ * Copyright 2016-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/MapKeyValueAdapterUnitTests.java b/src/test/java/org/springframework/data/map/MapKeyValueAdapterUnitTests.java
index dae4f324..9a24625f 100644
--- a/src/test/java/org/springframework/data/map/MapKeyValueAdapterUnitTests.java
+++ b/src/test/java/org/springframework/data/map/MapKeyValueAdapterUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/QuerydslKeyValuePredicateExecutorUnitTests.java b/src/test/java/org/springframework/data/map/QuerydslKeyValuePredicateExecutorUnitTests.java
index e5aa6e26..267b75d3 100644
--- a/src/test/java/org/springframework/data/map/QuerydslKeyValuePredicateExecutorUnitTests.java
+++ b/src/test/java/org/springframework/data/map/QuerydslKeyValuePredicateExecutorUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/SimpleKeyValueRepositoryUnitTests.java b/src/test/java/org/springframework/data/map/SimpleKeyValueRepositoryUnitTests.java
index 0dea2c85..51d75c6b 100644
--- a/src/test/java/org/springframework/data/map/SimpleKeyValueRepositoryUnitTests.java
+++ b/src/test/java/org/springframework/data/map/SimpleKeyValueRepositoryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java b/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java
index b6acc7b0..d4b5fabd 100644
--- a/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java
+++ b/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2024 the original author or authors.
+ * Copyright 2014-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +19,11 @@
import static org.mockito.Mockito.*;
import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.function.Predicate;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
@@ -32,12 +35,24 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.annotation.Id;
+import org.springframework.data.domain.Sort;
import org.springframework.data.keyvalue.core.KeyValueAdapter;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.keyvalue.core.KeyValueTemplate;
import org.springframework.data.keyvalue.core.PathSortAccessor;
+import org.springframework.data.keyvalue.core.QueryEngine;
+import org.springframework.data.keyvalue.core.QueryEngineFactory;
+import org.springframework.data.keyvalue.core.SortAccessor;
+import org.springframework.data.keyvalue.core.SpelQueryEngine;
+import org.springframework.data.keyvalue.core.query.KeyValueQuery;
import org.springframework.data.keyvalue.repository.KeyValueRepository;
+import org.springframework.data.keyvalue.repository.query.PredicateQueryCreator;
+import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean;
import org.springframework.data.map.MapKeyValueAdapter;
+import org.springframework.data.repository.query.ParameterAccessor;
+import org.springframework.data.repository.query.parser.AbstractQueryCreator;
+import org.springframework.data.repository.query.parser.Part;
+import org.springframework.data.repository.query.parser.PartTree;
import org.springframework.test.util.ReflectionTestUtils;
/**
@@ -78,7 +93,8 @@ void shouldUseCustomAdapter() {
PersonRepository repository = context.getBean(PersonRepository.class);
- assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class).hasMessageContaining("Mock");
+ assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class)
+ .hasMessageContaining("Mock");
context.close();
}
@@ -101,6 +117,41 @@ void considersSortAccessorConfiguredOnAnnotation() {
new AnnotationConfigApplicationContext(ConfigWithCustomizedSortAccessor.class));
}
+ @Test // GH-576
+ void considersQueryEngineConfiguration() {
+
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigWithQueryEngine.class);
+
+ KeyValueTemplate template = context.getBean(KeyValueTemplate.class);
+ Object adapter = ReflectionTestUtils.getField(template, "adapter");
+
+ assertThat(adapter).isInstanceOf(MapKeyValueAdapter.class);
+
+ Object engine = ReflectionTestUtils.getField(adapter, "engine");
+
+ assertThat(engine).isInstanceOf(SpelQueryEngine.class);
+ }
+
+ @Test // GH-576
+ void considersQueryEngineAndSortAccessorConfiguration() {
+
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
+ ConfigWithQueryEngineAndCustomizedSortAccessor.class);
+
+ KeyValueTemplate template = context.getBean(KeyValueTemplate.class);
+ Object adapter = ReflectionTestUtils.getField(template, "adapter");
+
+ assertThat(adapter).isInstanceOf(MapKeyValueAdapter.class);
+
+ Object engine = ReflectionTestUtils.getField(adapter, "engine");
+
+ assertThat(engine).isInstanceOf(SpelQueryEngine.class);
+ Object sortAccessor = ReflectionTestUtils.getField(engine, "sortAccessor");
+
+ assertThat(sortAccessor).asInstanceOf(InstanceOfAssertFactories.OPTIONAL)
+ .containsInstanceOf(PathSortAccessor.class);
+ }
+
private static void assertKeyValueTemplateWithAdapterFor(Class> mapType, ApplicationContext context) {
KeyValueTemplate template = context.getBean(KeyValueTemplate.class);
@@ -123,8 +174,32 @@ private static void assertKeyValueTemplateWithSortAccessorFor(Class> sortAcces
assertThat(sortAccessor).asInstanceOf(InstanceOfAssertFactories.OPTIONAL).containsInstanceOf(sortAccessorType);
}
+ @Test // GH-576
+ void considersDefaultQueryCreator() {
+
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
+
+ KeyValueRepositoryFactoryBean, ?, ?> factoryBean = context.getBean(KeyValueRepositoryFactoryBean.class);
+ Object queryCreator = ReflectionTestUtils.getField(factoryBean, "queryCreator");
+
+ assertThat(queryCreator).isEqualTo(PredicateQueryCreator.class);
+ }
+
+ @Test // GH-576
+ void considersCustomQueryCreator() {
+
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
+ ConfigWithCustomQueryCreator.class);
+
+ KeyValueRepositoryFactoryBean, ?, ?> factoryBean = context.getBean(KeyValueRepositoryFactoryBean.class);
+ Object queryCreator = ReflectionTestUtils.getField(factoryBean, "queryCreator");
+
+ assertThat(queryCreator).isEqualTo(MyQueryCreator.class);
+ }
+
@Configuration
- @EnableMapRepositories
+ @EnableMapRepositories(considerNestedRepositories = true,
+ includeFilters = @ComponentScan.Filter(value = PersonRepository.class, type = FilterType.ASSIGNABLE_TYPE))
static class Config {}
@Configuration
@@ -167,9 +242,74 @@ public KeyValueTemplate mapKeyValueTemplate() {
}
}
+ @EnableMapRepositories(queryEngineFactory = JustSpelQueryEngineFactory.class)
+ static class ConfigWithQueryEngine {}
+
+ static class JustSpelQueryEngineFactory implements QueryEngineFactory {
+
+ @Override
+ public QueryEngine, ?, ?> create() {
+ return new SpelQueryEngine();
+ }
+
+ }
+
@EnableMapRepositories(sortAccessor = PathSortAccessor.class)
static class ConfigWithCustomizedSortAccessor {}
+ @EnableMapRepositories(sortAccessor = PathSortAccessor.class, queryEngineFactory = SpelQueryEngineFactory.class)
+ static class ConfigWithQueryEngineAndCustomizedSortAccessor {}
+
+ @EnableMapRepositories(queryCreator = MyQueryCreator.class, considerNestedRepositories = true,
+ includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = PersonRepository.class))
+ static class ConfigWithCustomQueryCreator {}
+
+ static class SpelQueryEngineFactory implements QueryEngineFactory {
+
+ private final SortAccessor> sortAccessor;
+
+ public SpelQueryEngineFactory(SortAccessor> sortAccessor) {
+ this.sortAccessor = sortAccessor;
+ }
+
+ @Override
+ public QueryEngine, ?, ?> create() {
+ return new SpelQueryEngine(sortAccessor);
+ }
+
+ }
+
+ static class MyQueryCreator extends AbstractQueryCreator>, Predicate>> {
+
+ public MyQueryCreator(PartTree tree) {
+ super(tree);
+ }
+
+ public MyQueryCreator(PartTree tree, ParameterAccessor parameters) {
+ super(tree, parameters);
+ }
+
+ @Override
+ protected Predicate> create(Part part, Iterator