diff --git a/.gitignore b/.gitignore
index 419a1317bd..62d57535ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,6 @@ work
build/
node_modules
node
-package.json
package-lock.json
-.mvn/.gradle-enterprise
+package.json
+.mvn/.develocity
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index ebd7610255..e0857eaa25 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 c244063147..0000000000
--- 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 0000000000..e27f6e8f5e
--- /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 113cc85066..b5058cdcaf 100755
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1,2 +1,2 @@
-#Thu Dec 14 08:40:45 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:49:32 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 4ce7abdfee..8c1c07be1b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -9,7 +9,7 @@ pipeline {
triggers {
pollSCM 'H/10 * * * *'
- upstream(upstreamProjects: "spring-data-keyvalue/main", threshold: hudson.model.Result.SUCCESS)
+ upstream(upstreamProjects: "spring-data-keyvalue/3.3.x", threshold: hudson.model.Result.SUCCESS)
}
options {
@@ -33,7 +33,7 @@ pipeline {
steps {
script {
- def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk17-redis-6.2/Dockerfile .")
+ def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg VERSION=${p['docker.redis.6.version']} -f ci/openjdk17-redis-6.2/Dockerfile .")
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
@@ -53,7 +53,27 @@ pipeline {
steps {
script {
- def image = docker.build("springci/spring-data-with-redis-7.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg REDIS=${p['docker.redis.7.version']} -f ci/openjdk17-redis-7.2/Dockerfile .")
+ def image = docker.build("springci/spring-data-with-redis-7.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg VERSION=${p['docker.redis.7.version']} -f ci/openjdk17-redis-7.2/Dockerfile .")
+ docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
+ image.push()
+ }
+ }
+ }
+ }
+ stage('Publish JDK 17 + Valkey 7.2 Docker Image') {
+ when {
+ anyOf {
+ changeset "ci/openjdk17-valkey-7.2/Dockerfile"
+ changeset "Makefile"
+ changeset "ci/pipeline.properties"
+ }
+ }
+ agent { label 'data' }
+ options { timeout(time: 20, unit: 'MINUTES') }
+
+ steps {
+ script {
+ def image = docker.build("springci/spring-data-with-valkey-7.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg VERSION=${p['docker.redis.7.version']} -f ci/openjdk17-redis-7.2/Dockerfile .")
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
@@ -73,7 +93,7 @@ pipeline {
steps {
script {
- def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk21-redis-6.2/Dockerfile .")
+ def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg VERSION=${p['docker.redis.6.version']} -f ci/openjdk21-redis-6.2/Dockerfile .")
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
@@ -97,13 +117,14 @@ 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("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
- sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image("springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) {
+ sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ }
}
}
}
@@ -125,13 +146,14 @@ 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("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
- sh "PROFILE=runtimehints LONG_TESTS=false JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image("springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) {
+ sh "PROFILE=runtimehints LONG_TESTS=false JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ }
}
}
}
@@ -143,13 +165,14 @@ 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("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.next.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
- sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image("springci/spring-data-with-redis-6.2:${p['java.next.tag']}").inside(p['docker.java.inside.docker']) {
+ sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ }
}
}
}
@@ -161,13 +184,34 @@ 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("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-7.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
- sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image("springci/spring-data-with-redis-7.2:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) {
+ sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ }
+ }
+ }
+ }
+ }
+
+ stage("test: Valkey 7") {
+ agent {
+ label 'data'
+ }
+ options { timeout(time: 30, unit: 'MINUTES') }
+ environment {
+ ARTIFACTORY = credentials("${p['artifactory.credentials']}")
+ DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
+ }
+ steps {
+ script {
+ docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
+ docker.image("springci/spring-data-with-valkey-7.2:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) {
+ sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
+ }
}
}
}
@@ -190,25 +234,25 @@ pipeline {
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-redis " +
- "-Dartifactory.build-number=spring-data-redis-${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-redis " +
+ "-Dartifactory.build-number=spring-data-redis-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
+ "-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-redis " +
+ "-Dmaven.test.skip=true clean deploy -U -B"
+ }
}
}
}
@@ -218,10 +262,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/Makefile b/Makefile
index 35334f506d..304a2648ba 100644
--- a/Makefile
+++ b/Makefile
@@ -12,16 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-REDIS_VERSION:=7.2.4
+VERSION:=7.2.5
+PROJECT?=redis
+GH_ORG?=redis
SPRING_PROFILE?=ci
SHELL=/bin/bash -euo pipefail
#######
# Redis
#######
-.PRECIOUS: work/redis-%.conf
+.PRECIOUS: work/$(PROJECT)-%.conf
-work/redis-%.conf:
+work/$(PROJECT)-%.conf:
@mkdir -p $(@D)
echo port $* >> $@
@@ -29,15 +31,15 @@ work/redis-%.conf:
echo protected-mode no >> $@
echo bind 0.0.0.0 >> $@
echo notify-keyspace-events Ex >> $@
- echo pidfile $(shell pwd)/work/redis-$*.pid >> $@
- echo logfile $(shell pwd)/work/redis-$*.log >> $@
- echo unixsocket $(shell pwd)/work/redis-$*.sock >> $@
+ echo pidfile $(shell pwd)/work/$(PROJECT)-$*.pid >> $@
+ echo logfile $(shell pwd)/work/$(PROJECT)-$*.log >> $@
+ echo unixsocket $(shell pwd)/work/$(PROJECT)-$*.sock >> $@
echo unixsocketperm 755 >> $@
echo save \"\" >> $@
echo slaveof 127.0.0.1 6379 >> $@
# Handled separately because it's a node with authentication. User: spring, password: data. Default password: foobared
-work/redis-6382.conf:
+work/$(PROJECT)-6382.conf:
@mkdir -p $(@D)
echo port 6382 >> $@
@@ -45,9 +47,9 @@ work/redis-6382.conf:
echo protected-mode no >> $@
echo bind 0.0.0.0 >> $@
echo notify-keyspace-events Ex >> $@
- echo pidfile $(shell pwd)/work/redis-6382.pid >> $@
- echo logfile $(shell pwd)/work/redis-6382.log >> $@
- echo unixsocket $(shell pwd)/work/redis-6382.sock >> $@
+ echo pidfile $(shell pwd)/work/$(PROJECT)-6382.pid >> $@
+ echo logfile $(shell pwd)/work/$(PROJECT)-6382.log >> $@
+ echo unixsocket $(shell pwd)/work/$(PROJECT)-6382.sock >> $@
echo unixsocketperm 755 >> $@
echo "requirepass foobared" >> $@
echo "user default on #1b58ee375b42e41f0e48ef2ff27d10a5b1f6924a9acdcdba7cae868e7adce6bf ~* +@all" >> $@
@@ -55,7 +57,7 @@ work/redis-6382.conf:
echo save \"\" >> $@
# Handled separately because it's the master and all others are slaves
-work/redis-6379.conf:
+work/$(PROJECT)-6379.conf:
@mkdir -p $(@D)
echo port 6379 >> $@
@@ -63,18 +65,18 @@ work/redis-6379.conf:
echo protected-mode no >> $@
echo bind 0.0.0.0 >> $@
echo notify-keyspace-events Ex >> $@
- echo pidfile $(shell pwd)/work/redis-6379.pid >> $@
- echo logfile $(shell pwd)/work/redis-6379.log >> $@
- echo unixsocket $(shell pwd)/work/redis-6379.sock >> $@
+ echo pidfile $(shell pwd)/work/$(PROJECT)-6379.pid >> $@
+ echo logfile $(shell pwd)/work/$(PROJECT)-6379.log >> $@
+ echo unixsocket $(shell pwd)/work/$(PROJECT)-6379.sock >> $@
echo unixsocketperm 755 >> $@
echo save \"\" >> $@
-work/redis-%.pid: work/redis-%.conf work/redis/bin/redis-server
- work/redis/bin/redis-server $<
+work/$(PROJECT)-%.pid: work/$(PROJECT)-%.conf work/$(PROJECT)/bin/$(PROJECT)-server
+ work/$(PROJECT)/bin/$(PROJECT)-server $<
-redis-start: work/redis-6379.pid work/redis-6380.pid work/redis-6381.pid work/redis-6382.pid
+server-start: work/$(PROJECT)-6379.pid work/$(PROJECT)-6380.pid work/$(PROJECT)-6381.pid work/$(PROJECT)-6382.pid
-redis-stop: stop-6379 stop-6380 stop-6381 stop-6382
+server-stop: stop-6379 stop-6380 stop-6381 stop-6382
##########
# Sentinel
@@ -110,8 +112,8 @@ work/sentinel-26382.conf:
echo sentinel monitor mymaster 127.0.0.1 6382 2 >> $@
echo sentinel auth-pass mymaster foobared >> $@
-work/sentinel-%.pid: work/sentinel-%.conf work/redis-6379.pid work/redis/bin/redis-server
- work/redis/bin/redis-server $< --sentinel
+work/sentinel-%.pid: work/sentinel-%.conf work/$(PROJECT)-6379.pid work/$(PROJECT)/bin/$(PROJECT)-server
+ work/$(PROJECT)/bin/$(PROJECT)-server $< --sentinel
sentinel-start: work/sentinel-26379.pid work/sentinel-26380.pid work/sentinel-26381.pid work/sentinel-26382.pid
@@ -136,20 +138,20 @@ work/cluster-%.conf:
echo logfile $(shell pwd)/work/cluster-$*.log >> $@
echo save \"\" >> $@
-work/cluster-%.pid: work/cluster-%.conf work/redis/bin/redis-server
- work/redis/bin/redis-server $< &
+work/cluster-%.pid: work/cluster-%.conf work/$(PROJECT)/bin/$(PROJECT)-server
+ work/$(PROJECT)/bin/$(PROJECT)-server $< &
cluster-start: work/cluster-7379.pid work/cluster-7380.pid work/cluster-7381.pid work/cluster-7382.pid
sleep 1
work/meet-%:
- -work/redis/bin/redis-cli -p $* cluster meet 127.0.0.1 7379
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p $* cluster meet 127.0.0.1 7379
# Handled separately because this node is a replica
work/meet-7382:
- -work/redis/bin/redis-cli -p 7382 cluster meet 127.0.0.1 7379
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p 7382 cluster meet 127.0.0.1 7379
sleep 2
- -work/redis/bin/redis-cli -p 7382 cluster replicate $(shell work/redis/bin/redis-cli -p 7379 cluster myid)
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p 7382 cluster replicate $(shell work/$(PROJECT)/bin/$(PROJECT)-cli -p 7379 cluster myid)
cluster-meet: work/meet-7380 work/meet-7381 work/meet-7382
sleep 1
@@ -157,9 +159,9 @@ cluster-meet: work/meet-7380 work/meet-7381 work/meet-7382
cluster-stop: stop-7379 stop-7380 stop-7381 stop-7382
cluster-slots:
- -work/redis/bin/redis-cli -p 7379 cluster addslots $(shell seq 0 5460)
- -work/redis/bin/redis-cli -p 7380 cluster addslots $(shell seq 5461 10922)
- -work/redis/bin/redis-cli -p 7381 cluster addslots $(shell seq 10923 16383)
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p 7379 cluster addslots $(shell seq 0 5460)
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p 7380 cluster addslots $(shell seq 5461 10922)
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p 7381 cluster addslots $(shell seq 10923 16383)
cluster-init: cluster-start cluster-meet cluster-slots
@@ -172,38 +174,38 @@ clean:
clobber:
rm -rf work
-work/redis/bin/redis-cli work/redis/bin/redis-server:
- @mkdir -p work/redis
+work/$(PROJECT)/bin/$(PROJECT)-cli work/$(PROJECT)/bin/$(PROJECT)-server:
+ @mkdir -p work/$(PROJECT)
- curl -sSL https://github.com/redis/redis/archive/$(REDIS_VERSION).tar.gz | tar xzf - -C work
- $(MAKE) -C work/redis-$(REDIS_VERSION) -j
- $(MAKE) -C work/redis-$(REDIS_VERSION) PREFIX=$(shell pwd)/work/redis install
- rm -rf work/redis-$(REDIS_VERSION)
+ curl -sSL https://github.com/$(GH_ORG)/$(PROJECT)/archive/refs/tags/$(VERSION).tar.gz | tar xzf - -C work
+ $(MAKE) -C work/$(PROJECT)-$(VERSION) -j
+ $(MAKE) -C work/$(PROJECT)-$(VERSION) PREFIX=$(shell pwd)/work/$(PROJECT) install
+ rm -rf work/$(PROJECT)-$(VERSION)
-start: redis-start sentinel-start cluster-init
+start: server-start sentinel-start cluster-init
-stop-%: work/redis/bin/redis-cli
- -work/redis/bin/redis-cli -p $* shutdown
+stop-%: work/$(PROJECT)/bin/$(PROJECT)-cli
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -p $* shutdown
-stop-6382: work/redis/bin/redis-cli
- -work/redis/bin/redis-cli -a foobared -p 6382 shutdown
+stop-6382: work/$(PROJECT)/bin/$(PROJECT)-cli
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -a foobared -p 6382 shutdown
-stop-26382: work/redis/bin/redis-cli
- -work/redis/bin/redis-cli -a foobared -p 26382 shutdown
+stop-26382: work/$(PROJECT)/bin/$(PROJECT)-cli
+ -work/$(PROJECT)/bin/$(PROJECT)-cli -a foobared -p 26382 shutdown
-stop: redis-stop sentinel-stop cluster-stop
+stop: server-stop sentinel-stop cluster-stop
test:
$(MAKE) start
sleep 1
- ./mvnw clean test -U -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1)
+ ./mvnw clean test -U -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1)
$(MAKE) stop
$(MAKE) clean
all-tests:
$(MAKE) start
sleep 1
- ./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1)
+ ./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1)
$(MAKE) stop
$(MAKE) clean
diff --git a/README.adoc b/README.adoc
index 72089cab87..d6e327b798 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,11 +1,9 @@
-image:https://spring.io/badges/spring-data-redis/ga.svg[Spring Data Redis,link=https://spring.io/projects/spring-data-redis/#quick-start]
-image:https://spring.io/badges/spring-data-redis/snapshot.svg[Spring Data Redis,link=https://spring.io/projects/spring-data-redis/#quick-start]
-
= Spring Data Redis image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-redis%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-redis/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring%20Data%20Redis"]
The primary goal of the https://spring.io/projects/spring-data/[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
-This modules provides integration with the https://redis.io/[Redis] store.
+This module provides integration with the https://redis.io/[Redis] store.
+It is also tested to work with https://valkey.io/[Valkey] on a best-effort basis as long as Valkey remains largely compatible with Redis.
== Features
@@ -38,7 +36,7 @@ public class Example {
// inject the actual template
@Autowired
- private RedisTemplate template;
+ private RedisTemplate redisTemplate;
// inject the template as ListOperations
// can also inject as Value, Set, ZSet, and HashOperations
diff --git a/ci/openjdk17-redis-6.2/Dockerfile b/ci/openjdk17-redis-6.2/Dockerfile
index b983e39fb0..bf7cb4d390 100644
--- a/ci/openjdk17-redis-6.2/Dockerfile
+++ b/ci/openjdk17-redis-6.2/Dockerfile
@@ -1,16 +1,20 @@
ARG BASE
FROM ${BASE}
# Any ARG statements before FROM are cleared.
-ARG REDIS
+ARG VERSION
+ENV VERSION=${VERSION}
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
RUN set -eux; \
-# sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
+ sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
+ sed -i -e 's/http/https/g' /etc/apt/sources.list && \
apt-get update ; \
apt-get install -y build-essential ; \
- make work/redis/bin/redis-cli work/redis/bin/redis-server REDIS_VERSION=${REDIS}; \
+ make work/redis/bin/redis-cli work/redis/bin/redis-server VERSION=${VERSION}; \
chmod -R o+rw work; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
diff --git a/ci/openjdk17-redis-7.2/Dockerfile b/ci/openjdk17-redis-7.2/Dockerfile
index 6251772188..bf7cb4d390 100644
--- a/ci/openjdk17-redis-7.2/Dockerfile
+++ b/ci/openjdk17-redis-7.2/Dockerfile
@@ -1,17 +1,20 @@
ARG BASE
FROM ${BASE}
# Any ARG statements before FROM are cleared.
-ARG REDIS
-ENV REDIS_VERSION=${REDIS}
+ARG VERSION
+ENV VERSION=${VERSION}
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
RUN set -eux; \
-# sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
+ sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
+ sed -i -e 's/http/https/g' /etc/apt/sources.list && \
apt-get update ; \
apt-get install -y build-essential ; \
- make work/redis/bin/redis-cli work/redis/bin/redis-server REDIS_VERSION=${REDIS}; \
+ make work/redis/bin/redis-cli work/redis/bin/redis-server VERSION=${VERSION}; \
chmod -R o+rw work; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
diff --git a/ci/openjdk17-valkey-7.2/Dockerfile b/ci/openjdk17-valkey-7.2/Dockerfile
new file mode 100644
index 0000000000..2c7dfcbce4
--- /dev/null
+++ b/ci/openjdk17-valkey-7.2/Dockerfile
@@ -0,0 +1,22 @@
+ARG BASE
+FROM ${BASE}
+# Any ARG statements before FROM are cleared.
+ARG VERSION
+ENV VERSION=${VERSION}
+ENV PROJECT=valkey
+ENV GH_ORG=valkey-io
+
+# Copy Spring Data Redis's Makefile into the container
+COPY ./Makefile /
+
+RUN set -eux; \
+ sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
+ sed -i -e 's/http/https/g' /etc/apt/sources.list && \
+ apt-get update ; \
+ apt-get install -y build-essential ; \
+ make work/valkey/bin/valkey-cli work/valkey/bin/valkey-server VERSION=${VERSION}; \
+ chmod -R o+rw work; \
+ apt-get clean; \
+ rm -rf /var/lib/apt/lists/*;
diff --git a/ci/openjdk21-redis-6.2/Dockerfile b/ci/openjdk21-redis-6.2/Dockerfile
index b983e39fb0..a92d2b8fd6 100644
--- a/ci/openjdk21-redis-6.2/Dockerfile
+++ b/ci/openjdk21-redis-6.2/Dockerfile
@@ -1,16 +1,20 @@
ARG BASE
FROM ${BASE}
# Any ARG statements before FROM are cleared.
-ARG REDIS
+ARG VERSION
+ENV VERSION=${VERSION}
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
RUN set -eux; \
-# sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
+ sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
+ sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
+ sed -i -e 's/http/https/g' /etc/apt/sources.list && \
apt-get update ; \
- apt-get install -y build-essential ; \
- make work/redis/bin/redis-cli work/redis/bin/redis-server REDIS_VERSION=${REDIS}; \
+ apt-get install -y build-essential curl ; \
+ make work/redis/bin/redis-cli work/redis/bin/redis-server VERSION=${VERSION}; \
chmod -R o+rw work; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
diff --git a/ci/pipeline.properties b/ci/pipeline.properties
index 6ff93899b4..81d1e2904b 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
@@ -26,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/ci/test.sh b/ci/test.sh
index 06db99ec5d..5bee10b054 100755
--- a/ci/test.sh
+++ b/ci/test.sh
@@ -10,15 +10,10 @@ cwd=$(pwd)
# Launch Redis in proper configuration
pushd /tmp && ln -s /work && make -f $cwd/Makefile start && popd
-export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR}
-export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW}
export JENKINS_USER=${JENKINS_USER_NAME}
-# The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY
-export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY}
-
# Execute maven test
-MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -Dredis.server.version=${REDIS_VERSION:-unknown} -U -B
+MAVEN_OPTS="-Duser.name=${JENKINS_USER} -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-redis clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -Dredis.server.version=${REDIS_VERSION:-unknown} -U -B
# Capture resulting exit code from maven (pass/fail)
RESULT=$?
diff --git a/pom.xml b/pom.xml
index 44cf4b718f..f27dbda213 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.dataspring-data-redis
- 3.3.0
+ 3.3.13-SNAPSHOTSpring Data RedisSpring Data module for Redis
@@ -14,15 +14,15 @@
org.springframework.data.buildspring-data-parent
- 3.3.0
+ 3.3.13-SNAPSHOT
- 3.3.0
- 3.3.0
+ 3.3.13-SNAPSHOT
+ 3.3.13-SNAPSHOT4.0.21.9.4
- 1.4.20
+ 1.4.212.11.16.3.2.RELEASE5.0.2
@@ -317,17 +317,6 @@
maven-assembly-plugin
-
- org.asciidoctor
- asciidoctor-maven-plugin
-
-
- ${lettuce}
- ${jedis}
-
-
-
-
@@ -378,7 +367,7 @@
- io.spring.maven.antora
+ org.antoraantora-maven-plugin
@@ -387,7 +376,19 @@
-
-
+
+ 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 b68f34c9b8..b90d6ab326 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-redis'
site:
title: Spring Data Redis
@@ -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 3b978752a0..f2cc6bda15 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 11f202b10c..7cc4db98ce 100644
--- a/src/main/antora/modules/ROOT/nav.adoc
+++ b/src/main/antora/modules/ROOT/nav.adoc
@@ -44,4 +44,6 @@
* xref:appendix.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/redis/cluster.adoc b/src/main/antora/modules/ROOT/pages/redis/cluster.adoc
index 2dda2c0b94..9e1e18f68c 100644
--- a/src/main/antora/modules/ROOT/pages/redis/cluster.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/cluster.adoc
@@ -37,14 +37,14 @@ The following example shows a set of commands being run across the cluster:
redis-cli@127.0.0.1:7379 > cluster nodes
6b38bb... 127.0.0.1:7379 master - 0 0 25 connected 0-5460 <1>
-7bb78c... 127.0.0.1:7380 master - 0 1449730618304 2 connected 5461-20242 <2>
-164888... 127.0.0.1:7381 master - 0 1449730618304 3 connected 10923-20243 <3>
+7bb78c... 127.0.0.1:7380 master - 0 1449730618304 2 connected 5461-20252 <2>
+164888... 127.0.0.1:7381 master - 0 1449730618304 3 connected 10923-20253 <3>
b8b5ee... 127.0.0.1:7382 slave 6b38bb... 0 1449730618304 25 connected <4>
----
[source,java]
----
-RedisClusterConnection connection = connectionFactory.getClusterConnnection();
+RedisClusterConnection connection = connectionFactory.getClusterConnection();
connection.set("thing1", value); <5>
connection.set("thing2", value); <6>
@@ -88,7 +88,7 @@ redis-cli@127.0.0.1:7379 > cluster nodes
[source,java]
----
-RedisClusterConnection connection = connectionFactory.getClusterConnnection();
+RedisClusterConnection connection = connectionFactory.getClusterConnection();
connection.set("thing1", value); // slot: 12182
connection.set("{thing1}.thing2", value); // slot: 12182
@@ -134,5 +134,5 @@ clusterOps.shutdown(NODE_7379); <1>
<1> Shut down node at 7379 and cross fingers there is a replica in place that can take over.
====
-NOTE: Redis Cluster pipelining is currently only supported throug the Lettuce driver except for the following commands when using cross-slot keys: `rename`, `renameNX`, `sort`, `bLPop`, `bRPop`, `rPopLPush`, `bRPopLPush`, `info`, `sMove`, `sInter`, `sInterStore`, `sUnion`, `sUnionStore`, `sDiff`, `sDiffStore`.
+NOTE: Redis Cluster pipelining is currently only supported through the Lettuce driver except for the following commands when using cross-slot keys: `rename`, `renameNX`, `sort`, `bLPop`, `bRPop`, `rPopLPush`, `bRPopLPush`, `info`, `sMove`, `sInter`, `sInterStore`, `sUnion`, `sUnionStore`, `sDiff`, `sDiffStore`.
Same-slot keys are fully supported.
diff --git a/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc b/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc
index 062eb33d06..2a8f11623f 100644
--- a/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc
@@ -9,7 +9,7 @@ Each mode of operation requires specific configuration that is explained in the
The easiest way to get started is by using Redis Standalone with a single Redis server,
-Configure `LettuceClientConfiguration` or `JedisConnectionFactory`, as shown in the following example:
+Configure javadoc:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory[] or javadoc:org.springframework.data.redis.connection.jedis.JedisConnectionFactory[], as shown in the following example:
[source,java]
----
@@ -60,12 +60,12 @@ class WriteToMasterReadFromReplicaConfiguration {
}
----
-TIP: For environments reporting non-public addresses through the `INFO` command (for example, when using AWS), use `RedisStaticMasterReplicaConfiguration` instead of `RedisStandaloneConfiguration`. Please note that `RedisStaticMasterReplicaConfiguration` does not support Pub/Sub because of missing Pub/Sub message propagation across individual servers.
+TIP: For environments reporting non-public addresses through the `INFO` command (for example, when using AWS), use javadoc:org.springframework.data.redis.connection.RedisStaticMasterReplicaConfiguration[] instead of javadoc:org.springframework.data.redis.connection.RedisStandaloneConfiguration[]. Please note that `RedisStaticMasterReplicaConfiguration` does not support Pub/Sub because of missing Pub/Sub message propagation across individual servers.
[[redis:sentinel]]
== Redis Sentinel
-For dealing with high-availability Redis, Spring Data Redis has support for https://redis.io/topics/sentinel[Redis Sentinel], using `RedisSentinelConfiguration`, as shown in the following example:
+For dealing with high-availability Redis, Spring Data Redis has support for https://redis.io/topics/sentinel[Redis Sentinel], using javadoc:org.springframework.data.redis.connection.RedisSentinelConfiguration[], as shown in the following example:
[source,java]
----
@@ -113,8 +113,8 @@ Sometimes, direct interaction with one of the Sentinels is required. Using `Redi
[[cluster.enable]]
== Redis Cluster
-xref:redis/cluster.adoc[Cluster support] is based on the same building blocks as non-clustered communication. `RedisClusterConnection`, an extension to `RedisConnection`, handles the communication with the Redis Cluster and translates errors into the Spring DAO exception hierarchy.
-`RedisClusterConnection` instances are created with the `RedisConnectionFactory`, which has to be set up with the associated `RedisClusterConfiguration`, as shown in the following example:
+xref:redis/cluster.adoc[Cluster support] is based on the same building blocks as non-clustered communication. javadoc:org.springframework.data.redis.connection.RedisClusterConnection[], an extension to `RedisConnection`, handles the communication with the Redis Cluster and translates errors into the Spring DAO exception hierarchy.
+`RedisClusterConnection` instances are created with the `RedisConnectionFactory`, which has to be set up with the associated javadoc:org.springframework.data.redis.connection.RedisClusterConfiguration[], as shown in the following example:
.Sample RedisConnectionFactory Configuration for Redis Cluster
====
diff --git a/src/main/antora/modules/ROOT/pages/redis/drivers.adoc b/src/main/antora/modules/ROOT/pages/redis/drivers.adoc
index 2f649f3166..52570144d5 100644
--- a/src/main/antora/modules/ROOT/pages/redis/drivers.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/drivers.adoc
@@ -154,7 +154,7 @@ public LettuceConnectionFactory lettuceConnectionFactory() {
}
----
-For more detailed client configuration tweaks, see https://docs.spring.io/spring-data/redis/docs/current/api/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.html[`LettuceClientConfiguration`].
+For more detailed client configuration tweaks, see javadoc:org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration[].
Lettuce integrates with Netty's https://netty.io/wiki/native-transports.html[native transports], letting you use Unix domain sockets to communicate with Redis.
Make sure to include the appropriate native transport dependencies that match your runtime environment.
diff --git a/src/main/antora/modules/ROOT/pages/redis/getting-started.adoc b/src/main/antora/modules/ROOT/pages/redis/getting-started.adoc
index 4c16e17e98..3a803ad85b 100644
--- a/src/main/antora/modules/ROOT/pages/redis/getting-started.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/getting-started.adoc
@@ -37,5 +37,5 @@ include::example$examples/ReactiveRedisApplication.java[tags=file]
Even in this simple example, there are a few notable things to point out:
-* You can create an instance of `RedisTemplate` (or `ReactiveRedisTemplate` for reactive usage) with a `RedisConnectionFactory`. Connection factories are an abstraction on top of the supported drivers.
+* You can create an instance of javadoc:org.springframework.data.redis.core.RedisTemplate[] (or javadoc:org.springframework.data.redis.core.ReactiveRedisTemplate[]for reactive usage) with a javadoc:org.springframework.data.redis.connection.RedisConnectionFactory[]. Connection factories are an abstraction on top of the supported drivers.
* There's no single way to use Redis as it comes with support for a wide range of data structures such as plain keys ("strings"), lists, sets, sorted sets, streams, hashes and so on.
diff --git a/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc b/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc
index 2ecbc321b7..334a2fd515 100644
--- a/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc
@@ -1,21 +1,21 @@
[[redis.hashmappers.root]]
= Hash Mapping
-Data can be stored by using various data structures within Redis. `Jackson2JsonRedisSerializer` can convert objects in https://en.wikipedia.org/wiki/JSON[JSON] format. Ideally, JSON can be stored as a value by using plain keys. You can achieve a more sophisticated mapping of structured objects by using Redis hashes. Spring Data Redis offers various strategies for mapping data to hashes (depending on the use case):
+Data can be stored by using various data structures within Redis. javadoc:org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer[] can convert objects in https://en.wikipedia.org/wiki/JSON[JSON] format. Ideally, JSON can be stored as a value by using plain keys. You can achieve a more sophisticated mapping of structured objects by using Redis hashes. Spring Data Redis offers various strategies for mapping data to hashes (depending on the use case):
-* Direct mapping, by using `HashOperations` and a xref:redis.adoc#redis:serializer[serializer]
+* Direct mapping, by using javadoc:org.springframework.data.redis.core.HashOperations[] and a xref:redis.adoc#redis:serializer[serializer]
* Using xref:repositories.adoc[Redis Repositories]
-* Using `HashMapper` and `HashOperations`
+* Using javadoc:org.springframework.data.redis.hash.HashMapper[] and javadoc:org.springframework.data.redis.core.HashOperations[]
[[redis.hashmappers.mappers]]
== Hash Mappers
-Hash mappers are converters of map objects to a `Map` and back. `HashMapper` is intended for using with Redis Hashes.
+Hash mappers are converters of map objects to a `Map` and back. javadoc:org.springframework.data.redis.hash.HashMapper[] is intended for using with Redis Hashes.
Multiple implementations are available:
-* `BeanUtilsHashMapper` using Spring's {spring-framework-javadoc}/org/springframework/beans/BeanUtils.html[BeanUtils].
-* `ObjectHashMapper` using xref:redis/redis-repositories/mapping.adoc[Object-to-Hash Mapping].
+* javadoc:org.springframework.data.redis.hash.BeanUtilsHashMapper[] using Spring's {spring-framework-javadoc}/org/springframework/beans/BeanUtils.html[BeanUtils].
+* javadoc:org.springframework.data.redis.hash.ObjectHashMapper[] using xref:redis/redis-repositories/mapping.adoc[Object-to-Hash Mapping].
* <> using https://github.com/FasterXML/jackson[FasterXML Jackson].
The following example shows one way to implement hash mapping:
@@ -53,7 +53,7 @@ public class HashMapping {
[[redis.hashmappers.jackson2]]
=== Jackson2HashMapper
-`Jackson2HashMapper` provides Redis Hash mapping for domain objects by using https://github.com/FasterXML/jackson[FasterXML Jackson].
+javadoc:org.springframework.data.redis.hash.Jackson2HashMapper[] provides Redis Hash mapping for domain objects by using https://github.com/FasterXML/jackson[FasterXML Jackson].
`Jackson2HashMapper` can map top-level properties as Hash field names and, optionally, flatten the structure.
Simple types map to simple values. Complex types (nested objects, collections, maps, and so on) are represented as nested JSON.
diff --git a/src/main/antora/modules/ROOT/pages/redis/pubsub.adoc b/src/main/antora/modules/ROOT/pages/redis/pubsub.adoc
index 0fdc427c58..6539ca127c 100644
--- a/src/main/antora/modules/ROOT/pages/redis/pubsub.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/pubsub.adoc
@@ -66,13 +66,13 @@ In order to subscribe to messages, one needs to implement the `MessageListener`
[[redis:pubsub:subscribe:containers]]
=== Message Listener Containers
-Due to its blocking nature, low-level subscription is not attractive, as it requires connection and thread management for every single listener. To alleviate this problem, Spring Data offers `RedisMessageListenerContainer`, which does all the heavy lifting. If you are familiar with EJB and JMS, you should find the concepts familiar, as it is designed to be as close as possible to the support in Spring Framework and its message-driven POJOs (MDPs).
+Due to its blocking nature, low-level subscription is not attractive, as it requires connection and thread management for every single listener. To alleviate this problem, Spring Data offers javadoc:org.springframework.data.redis.listener.RedisMessageListenerContainer[], which does all the heavy lifting. If you are familiar with EJB and JMS, you should find the concepts familiar, as it is designed to be as close as possible to the support in Spring Framework and its message-driven POJOs (MDPs).
-`RedisMessageListenerContainer` acts as a message listener container. It is used to receive messages from a Redis channel and drive the `MessageListener` instances that are injected into it. The listener container is responsible for all threading of message reception and dispatches into the listener for processing. A message listener container is the intermediary between an MDP and a messaging provider and takes care of registering to receive messages, resource acquisition and release, exception conversion, and the like. This lets you as an application developer write the (possibly complex) business logic associated with receiving a message (and reacting to it) and delegates boilerplate Redis infrastructure concerns to the framework.
+javadoc:org.springframework.data.redis.listener.RedisMessageListenerContainer[] acts as a message listener container. It is used to receive messages from a Redis channel and drive the javadoc:org.springframework.data.redis.connection.MessageListener[] instances that are injected into it. The listener container is responsible for all threading of message reception and dispatches into the listener for processing. A message listener container is the intermediary between an MDP and a messaging provider and takes care of registering to receive messages, resource acquisition and release, exception conversion, and the like. This lets you as an application developer write the (possibly complex) business logic associated with receiving a message (and reacting to it) and delegates boilerplate Redis infrastructure concerns to the framework.
-A `MessageListener` can additionally implement `SubscriptionListener` to receive notifications upon subscription/unsubscribe confirmation. Listening to subscription notifications can be useful when synchronizing invocations.
+A javadoc:org.springframework.data.redis.connection.MessageListener[] can additionally implement javadoc:org.springframework.data.redis.connection.SubscriptionListener[] to receive notifications upon subscription/unsubscribe confirmation. Listening to subscription notifications can be useful when synchronizing invocations.
-Furthermore, to minimize the application footprint, `RedisMessageListenerContainer` lets one connection and one thread be shared by multiple listeners even though they do not share a subscription. Thus, no matter how many listeners or channels an application tracks, the runtime cost remains the same throughout its lifetime. Moreover, the container allows runtime configuration changes so that you can add or remove listeners while an application is running without the need for a restart. Additionally, the container uses a lazy subscription approach, using a `RedisConnection` only when needed. If all the listeners are unsubscribed, cleanup is automatically performed, and the thread is released.
+Furthermore, to minimize the application footprint, javadoc:org.springframework.data.redis.listener.RedisMessageListenerContainer[] lets one connection and one thread be shared by multiple listeners even though they do not share a subscription. Thus, no matter how many listeners or channels an application tracks, the runtime cost remains the same throughout its lifetime. Moreover, the container allows runtime configuration changes so that you can add or remove listeners while an application is running without the need for a restart. Additionally, the container uses a lazy subscription approach, using a `RedisConnection` only when needed. If all the listeners are unsubscribed, cleanup is automatically performed, and the thread is released.
To help with the asynchronous nature of messages, the container requires a `java.util.concurrent.Executor` (or Spring's `TaskExecutor`) for dispatching the messages. Depending on the load, the number of listeners, or the runtime environment, you should change or tweak the executor to better serve your needs. In particular, in managed environments (such as app servers), it is highly recommended to pick a proper `TaskExecutor` to take advantage of its runtime.
@@ -80,7 +80,7 @@ To help with the asynchronous nature of messages, the container requires a `java
[[redis:pubsub:subscribe:adapter]]
=== The MessageListenerAdapter
-The `MessageListenerAdapter` class is the final component in Spring's asynchronous messaging support. In a nutshell, it lets you expose almost *any* class as a MDP (though there are some constraints).
+The javadoc:org.springframework.data.redis.listener.adapter.MessageListenerAdapter[] class is the final component in Spring's asynchronous messaging support. In a nutshell, it lets you expose almost *any* class as a MDP (though there are some constraints).
Consider the following interface definition:
@@ -96,7 +96,7 @@ public interface MessageDelegate {
}
----
-Notice that, although the interface does not extend the `MessageListener` interface, it can still be used as a MDP by using the `MessageListenerAdapter` class. Notice also how the various message handling methods are strongly typed according to the *contents* of the various `Message` types that they can receive and handle. In addition, the channel or pattern to which a message is sent can be passed in to the method as the second argument of type `String`:
+Notice that, although the interface does not extend the `MessageListener` interface, it can still be used as a MDP by using the javadoc:org.springframework.data.redis.listener.adapter.MessageListenerAdapter[] class. Notice also how the various message handling methods are strongly typed according to the *contents* of the various `Message` types that they can receive and handle. In addition, the channel or pattern to which a message is sent can be passed in to the method as the second argument of type `String`:
[source,java]
----
@@ -105,7 +105,7 @@ public class DefaultMessageDelegate implements MessageDelegate {
}
----
-Notice how the above implementation of the `MessageDelegate` interface (the above `DefaultMessageDelegate` class) has *no* Redis dependencies at all. It truly is a POJO that we make into an MDP with the following configuration:
+ Notice how the above implementation of the `MessageDelegate` interface (the above `DefaultMessageDelegate` class) has *no* Redis dependencies at all. It truly is a POJO that we make into an MDP with the following configuration:
[tabs]
======
@@ -193,7 +193,7 @@ Each time a message is received, the adapter automatically and transparently per
[[redis:reactive:pubsub:subscribe:containers]]
== Reactive Message Listener Container
-Spring Data offers `ReactiveRedisMessageListenerContainer` which does all the heavy lifting of conversion and subscription state management on behalf of the user.
+Spring Data offers javadoc:org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer[] which does all the heavy lifting of conversion and subscription state management on behalf of the user.
The message listener container itself does not require external threading resources. It uses the driver threads to publish messages.
@@ -223,7 +223,7 @@ stream.doOnNext(inner -> // notification hook when Redis subscriptions are synch
[[redis:reactive:pubsub:subscribe:template]]
=== Subscribing via template API
-As mentioned above you can directly use `ReactiveRedisTemplate` to subscribe to channels / patterns. This approach
+As mentioned above you can directly use javadoc:org.springframework.data.redis.core.ReactiveRedisTemplate[] to subscribe to channels / patterns. This approach
offers a straight forward, though limited solution as you lose the option to add subscriptions after the initial
ones. Nevertheless you still can control the message stream via the returned `Flux` using eg. `take(Duration)`. When
done reading, on error or cancellation all bound resources are freed again.
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc
index c965f352a9..4e9f48df54 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc
@@ -2,7 +2,7 @@
= Redis Cache
Spring Data Redis provides an implementation of Spring Framework's {spring-framework-docs}/integration.html#cache[Cache Abstraction] in the `org.springframework.data.redis.cache` package.
-To use Redis as a backing implementation, add `RedisCacheManager` to your configuration, as follows:
+To use Redis as a backing implementation, add javadoc:org.springframework.data.redis.cache.RedisCacheManager[] to your configuration, as follows:
[source,java]
----
@@ -12,7 +12,7 @@ public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory)
}
----
-`RedisCacheManager` behavior can be configured with `RedisCacheManagerBuilder`, letting you set the default `RedisCacheConfiguration`, transaction behavior, and predefined caches.
+`RedisCacheManager` behavior can be configured with javadoc:org.springframework.data.redis.cache.RedisCacheManager$RedisCacheManagerBuilder[], letting you set the default javadoc:org.springframework.data.redis.cache.RedisCacheManager[], transaction behavior, and predefined caches.
[source,java]
----
@@ -26,7 +26,7 @@ RedisCacheManager cacheManager = RedisCacheManager.builder(connectionFactory)
As shown in the preceding example, `RedisCacheManager` allows custom configuration on a per-cache basis.
-The behavior of `RedisCache` created by `RedisCacheManager` is defined with `RedisCacheConfiguration`.
+The behavior of javadoc:org.springframework.data.redis.cache.RedisCache[] created by javadoc:org.springframework.data.redis.cache.RedisCacheManager[] is defined with `RedisCacheConfiguration`.
The configuration lets you set key expiration times, prefixes, and `RedisSerializer` implementations for converting to and from the binary storage format, as shown in the following example:
[source,java]
@@ -36,7 +36,7 @@ RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCach
.disableCachingNullValues();
----
-`RedisCacheManager` defaults to a lock-free `RedisCacheWriter` for reading and writing binary values.
+javadoc:org.springframework.data.redis.cache.RedisCacheManager[] defaults to a lock-free javadoc:org.springframework.data.redis.cache.RedisCacheWriter[] for reading and writing binary values.
Lock-free caching improves throughput.
The lack of entry locking can lead to overlapping, non-atomic commands for the `Cache` `putIfAbsent` and `clean` operations, as those require multiple commands to be sent to Redis.
The locking counterpart prevents command overlap by setting an explicit lock key and checking against presence of this key, which leads to additional requests and potential command wait times.
@@ -47,8 +47,8 @@ It is possible to opt in to the locking behavior as follows:
[source,java]
----
-RedisCacheManager cacheMangager = RedisCacheManager
- .build(RedisCacheWriter.lockingRedisCacheWriter(connectionFactory))
+RedisCacheManager cacheManager = RedisCacheManager
+ .builder(RedisCacheWriter.lockingRedisCacheWriter(connectionFactory))
.cacheDefaults(RedisCacheConfiguration.defaultCacheConfig())
...
----
@@ -77,7 +77,7 @@ The `SCAN` strategy requires a batch size to avoid excessive Redis command round
[source,java]
----
RedisCacheManager cacheManager = RedisCacheManager
- .build(RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(1000)))
+ .builder(RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, BatchStrategies.scan(1000)))
.cacheDefaults(RedisCacheConfiguration.defaultCacheConfig())
...
----
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cdi-integration.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cdi-integration.adoc
index d841506565..bd36cb1c59 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cdi-integration.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cdi-integration.adoc
@@ -6,7 +6,7 @@ Spring offers sophisticated for creating bean instances.
Spring Data Redis ships with a custom CDI extension that lets you use the repository abstraction in CDI environments.
The extension is part of the JAR, so, to activate it, drop the Spring Data Redis JAR into your classpath.
-You can then set up the infrastructure by implementing a CDI Producer for the `RedisConnectionFactory` and `RedisOperations`, as shown in the following example:
+You can then set up the infrastructure by implementing a CDI Producer for the javadoc:org.springframework.data.redis.connection.RedisConnectionFactory[] and javadoc:org.springframework.data.redis.core.RedisOperations[], as shown in the following example:
[source,java]
----
@@ -62,7 +62,7 @@ class RepositoryClient {
}
----
-A Redis Repository requires `RedisKeyValueAdapter` and `RedisKeyValueTemplate` instances.
+A Redis Repository requires javadoc:org.springframework.data.redis.core.RedisKeyValueAdapter[] and javadoc:org.springframework.data.redis.core.RedisKeyValueTemplate[] instances.
These beans are created and managed by the Spring Data CDI extension if no provided beans are found.
-You can, however, supply your own beans to configure the specific properties of `RedisKeyValueAdapter` and `RedisKeyValueTemplate`.
+You can, however, supply your own beans to configure the specific properties of javadoc:org.springframework.data.redis.core.RedisKeyValueAdapter[] and javadoc:org.springframework.data.redis.core.RedisKeyValueTemplate[].
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cluster.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cluster.adoc
index 2ca39dee6d..2aa5e5eac5 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cluster.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/cluster.adoc
@@ -13,7 +13,6 @@ The following table shows the details of data on a cluster (based on previous ex
|people:e2c7dcee-b8cd-4424-883e-736ce564363e|id for hash|15171|127.0.0.1:7381
|people:a9d4b3a0-50d3-4538-a2fc-f7fc2581ee56|id for hash|7373|127.0.0.1:7380
|people:firstname:rand|index|1700|127.0.0.1:7379
-|
|===============
====
@@ -29,7 +28,6 @@ The following table shows what happens when you do (note the change in the slot
|\{people}:e2c7dcee-b8cd-4424-883e-736ce564363e|id for hash|2399|127.0.0.1:7379
|\{people}:a9d4b3a0-50d3-4538-a2fc-f7fc2581ee56|id for hash|2399|127.0.0.1:7379
|\{people}:firstname:rand|index|2399|127.0.0.1:7379
-|
|===============
====
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc
index 4372f7749b..ddb794213d 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc
@@ -3,7 +3,7 @@
Objects stored in Redis may be valid only for a certain amount of time.
This is especially useful for persisting short-lived objects in Redis without having to remove them manually when they reach their end of life.
-The expiration time in seconds can be set with `@RedisHash(timeToLive=...)` as well as by using `KeyspaceSettings` (see xref:redis/redis-repositories/keyspaces.adoc[Keyspaces]).
+The expiration time in seconds can be set with `@RedisHash(timeToLive=...)` as well as by using javadoc:org.springframework.data.redis.core.convert.KeyspaceConfiguration$KeyspaceSettings[] (see xref:redis/redis-repositories/keyspaces.adoc[Keyspaces]).
More flexible expiration times can be set by using the `@TimeToLive` annotation on either a numeric property or a method.
However, do not apply `@TimeToLive` on both a method and a property within the same class.
@@ -37,16 +37,16 @@ public class TimeToLiveOnMethod {
NOTE: Annotating a property explicitly with `@TimeToLive` reads back the actual `TTL` or `PTTL` value from Redis. -1 indicates that the object has no associated expiration.
-The repository implementation ensures subscription to https://redis.io/topics/notifications[Redis keyspace notifications] via `RedisMessageListenerContainer`.
+The repository implementation ensures subscription to https://redis.io/topics/notifications[Redis keyspace notifications] via javadoc:org.springframework.data.redis.listener.RedisMessageListenerContainer[].
When the expiration is set to a positive value, the corresponding `EXPIRE` command is run.
In addition to persisting the original, a phantom copy is persisted in Redis and set to expire five minutes after the original one.
-This is done to enable the Repository support to publish `RedisKeyExpiredEvent`, holding the expired value in Spring's `ApplicationEventPublisher` whenever a key expires, even though the original values have already been removed.
+This is done to enable the Repository support to publish javadoc:org.springframework.data.redis.core.RedisKeyExpiredEvent[], holding the expired value in Spring's `ApplicationEventPublisher` whenever a key expires, even though the original values have already been removed.
Expiry events are received on all connected applications that use Spring Data Redis repositories.
By default, the key expiry listener is disabled when initializing the application.
The startup mode can be adjusted in `@EnableRedisRepositories` or `RedisKeyValueAdapter` to start the listener with the application or upon the first insert of an entity with a TTL.
-See https://docs.spring.io/spring-data/redis/docs/{version}/api/org/springframework/data/redis/core/RedisKeyValueAdapter.EnableKeyspaceEvents.html[`EnableKeyspaceEvents`] for possible values.
+See javadoc:org.springframework.data.redis.core.RedisKeyValueAdapter$EnableKeyspaceEvents[] for possible values.
The `RedisKeyExpiredEvent` holds a copy of the expired domain object as well as the key.
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/usage.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/usage.adoc
index ca6a9c41b1..e7f4fae343 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/usage.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/usage.adoc
@@ -87,7 +87,7 @@ public void basicCrudOperations() {
}
----
-<1> Generates a new `id` if the current value is `null` or reuses an already set `id` value and stores properties of type `Person` inside the Redis Hash with a key that has a pattern of `keyspace:id` -- in this case, it might be `people:5d67b7e1-8640-2024-beeb-c666fab4c0e5`.
+<1> Generates a new `id` if the current value is `null` or reuses an already set `id` value and stores properties of type `Person` inside the Redis Hash with a key that has a pattern of `keyspace:id` -- in this case, it might be `people:5d67b7e1-8640-2025-beeb-c666fab4c0e5`.
<2> Uses the provided `id` to retrieve the object stored at `keyspace:id`.
<3> Counts the total number of entities available within the keyspace, `people`, defined by `@RedisHash` on `Person`.
<4> Removes the key for the given object from Redis.
diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc
index 97febc2cee..25d916f637 100644
--- a/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc
@@ -73,8 +73,8 @@ Due to its blocking nature, low-level polling is not attractive, as it requires
Spring Data ships with two implementations tailored to the used programming model:
-* `StreamMessageListenerContainer` acts as message listener container for imperative programming models. It is used to consume records from a Redis Stream and drive the `StreamListener` instances that are injected into it.
-* `StreamReceiver` provides a reactive variant of a message listener. It is used to consume messages from a Redis Stream as potentially infinite stream and emit stream messages through a `Flux`.
+* javadoc:org.springframework.data.redis.stream.StreamMessageListenerContainer[] acts as message listener container for imperative programming models. It is used to consume records from a Redis Stream and drive the javadoc:org.springframework.data.redis.stream.StreamListener[] instances that are injected into it.
+* javadoc:org.springframework.data.redis.stream.StreamReceiver[] provides a reactive variant of a message listener. It is used to consume messages from a Redis Stream as potentially infinite stream and emit stream messages through a `Flux`.
`StreamMessageListenerContainer` and `StreamReceiver` are responsible for all threading of message reception and dispatch into the listener for processing. A message listener container/receiver is the intermediary between an MDP and a messaging provider and takes care of registering to receive messages, resource acquisition and release, exception conversion, and the like. This lets you as an application developer write the (possibly complex) business logic associated with receiving a message (and reacting to it) and delegates boilerplate Redis infrastructure concerns to the framework.
@@ -84,7 +84,7 @@ Both containers allow runtime configuration changes so that you can add or remov
[[imperative-streammessagelistenercontainer]]
==== Imperative `StreamMessageListenerContainer`
-In a fashion similar to a Message-Driven Bean (MDB) in the EJB world, the Stream-Driven POJO (SDP) acts as a receiver for Stream messages. The one restriction on an SDP is that it must implement the `org.springframework.data.redis.stream.StreamListener` interface. Please also be aware that in the case where your POJO receives messages on multiple threads, it is important to ensure that your implementation is thread-safe.
+In a fashion similar to a Message-Driven Bean (MDB) in the EJB world, the Stream-Driven POJO (SDP) acts as a receiver for Stream messages. The one restriction on an SDP is that it must implement the javadoc:org.springframework.data.redis.stream.StreamListener[] interface. Please also be aware that in the case where your POJO receives messages on multiple threads, it is important to ensure that your implementation is thread-safe.
[source,java]
----
diff --git a/src/main/antora/modules/ROOT/pages/redis/scripting.adoc b/src/main/antora/modules/ROOT/pages/redis/scripting.adoc
index 38864e6e99..bb2766b444 100644
--- a/src/main/antora/modules/ROOT/pages/redis/scripting.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/scripting.adoc
@@ -3,9 +3,9 @@
Redis versions 2.6 and higher provide support for running Lua scripts through the https://redis.io/commands/eval[eval] and https://redis.io/commands/evalsha[evalsha] commands. Spring Data Redis provides a high-level abstraction for running scripts that handles serialization and automatically uses the Redis script cache.
-Scripts can be run by calling the `execute` methods of `RedisTemplate` and `ReactiveRedisTemplate`. Both use a configurable `ScriptExecutor` (or `ReactiveScriptExecutor`) to run the provided script. By default, the `ScriptExecutor` (or `ReactiveScriptExecutor`) takes care of serializing the provided keys and arguments and deserializing the script result. This is done through the key and value serializers of the template. There is an additional overload that lets you pass custom serializers for the script arguments and the result.
+Scripts can be run by calling the `execute` methods of `RedisTemplate` and `ReactiveRedisTemplate`. Both use a configurable javadoc:org.springframework.data.redis.core.script.ScriptExecutor[] (or javadoc:org.springframework.data.redis.core.script.ReactiveScriptExecutor[]) to run the provided script. By default, the javadoc:org.springframework.data.redis.core.script.ScriptExecutor[] (or javadoc:org.springframework.data.redis.core.script.ReactiveScriptExecutor[]) takes care of serializing the provided keys and arguments and deserializing the script result. This is done through the key and value serializers of the template. There is an additional overload that lets you pass custom serializers for the script arguments and the result.
-The default `ScriptExecutor` optimizes performance by retrieving the SHA1 of the script and attempting first to run `evalsha`, falling back to `eval` if the script is not yet present in the Redis script cache.
+The default javadoc:org.springframework.data.redis.core.script.ScriptExecutor[] optimizes performance by retrieving the SHA1 of the script and attempting first to run `evalsha`, falling back to `eval` if the script is not yet present in the Redis script cache.
The following example runs a common "`check-and-set`" scenario by using a Lua script. This is an ideal use case for a Redis script, as it requires that running a set of commands atomically, and the behavior of one command is influenced by the result of another.
@@ -34,7 +34,7 @@ public class Example {
RedisScript script;
public boolean checkAndSet(String expectedValue, String newValue) {
- return redisOperations.execute(script, singletonList("key"), asList(expectedValue, newValue));
+ return redisOperations.execute(script, singletonList("key"), expectedValue, newValue);
}
}
----
@@ -69,10 +69,10 @@ end
return false
----
-The preceding code configures a `RedisScript` pointing to a file called `checkandset.lua`, which is expected to return a boolean value. The script `resultType` should be one of `Long`, `Boolean`, `List`, or a deserialized value type. It can also be `null` if the script returns a throw-away status (specifically, `OK`).
+The preceding code configures a javadoc:org.springframework.data.redis.core.script.RedisScript[] pointing to a file called `checkandset.lua`, which is expected to return a boolean value. The script `resultType` should be one of `Long`, `Boolean`, `List`, or a deserialized value type. It can also be `null` if the script returns a throw-away status (specifically, `OK`).
TIP: It is ideal to configure a single instance of `DefaultRedisScript` in your application context to avoid re-calculation of the script's SHA1 on every script run.
-The `checkAndSet` method above then runs the scripts. Scripts can be run within a `SessionCallback` as part of a transaction or pipeline. See "`xref:redis/transactions.adoc[Redis Transactions]`" and "`xref:redis/pipelining.adoc[Pipelining]`" for more information.
+The `checkAndSet` method above then runs the scripts. Scripts can be run within a javadoc:org.springframework.data.redis.core.SessionCallback[] as part of a transaction or pipeline. See "`xref:redis/transactions.adoc[Redis Transactions]`" and "`xref:redis/pipelining.adoc[Pipelining]`" for more information.
The scripting support provided by Spring Data Redis also lets you schedule Redis scripts for periodic running by using the Spring Task and Scheduler abstractions. See the https://spring.io/projects/spring-framework/[Spring Framework] documentation for more details.
diff --git a/src/main/antora/modules/ROOT/pages/redis/support-classes.adoc b/src/main/antora/modules/ROOT/pages/redis/support-classes.adoc
index 14ae2a6ac9..e363bb4f53 100644
--- a/src/main/antora/modules/ROOT/pages/redis/support-classes.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/support-classes.adoc
@@ -4,11 +4,11 @@
Package `org.springframework.data.redis.support` offers various reusable components that rely on Redis as a backing store.
Currently, the package contains various JDK-based interface implementations on top of Redis, such as https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/concurrent/atomic/package-summary.html[atomic] counters and JDK https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Collection.html[Collections].
-NOTE: `RedisList` is forward-compatible with Java 21 `SequencedCollection`.
+NOTE: javadoc:org.springframework.data.redis.support.collections.RedisList[] is forward-compatible with Java 21 `SequencedCollection`.
The atomic counters make it easy to wrap Redis key incrementation while the collections allow easy management of Redis keys with minimal storage exposure or API leakage.
-In particular, the `RedisSet` and `RedisZSet` interfaces offer easy access to the set operations supported by Redis, such as `intersection` and `union`. `RedisList` implements the `List`, `Queue`, and `Deque` contracts (and their equivalent blocking siblings) on top of Redis, exposing the storage as a FIFO (First-In-First-Out), LIFO (Last-In-First-Out) or capped collection with minimal configuration.
-The following example shows the configuration for a bean that uses a `RedisList`:
+In particular, the javadoc:org.springframework.data.redis.support.collections.RedisSet[] and javadoc:org.springframework.data.redis.support.collections.RedisZSet[] interfaces offer easy access to the set operations supported by Redis, such as `intersection` and `union`. javadoc:org.springframework.data.redis.support.collections.RedisList[] implements the `List`, `Queue`, and `Deque` contracts (and their equivalent blocking siblings) on top of Redis, exposing the storage as a FIFO (First-In-First-Out), LIFO (Last-In-First-Out) or capped collection with minimal configuration.
+The following example shows the configuration for a bean that uses a javadoc:org.springframework.data.redis.support.collections.RedisList[]:
[tabs]
======
diff --git a/src/main/antora/modules/ROOT/pages/redis/template.adoc b/src/main/antora/modules/ROOT/pages/redis/template.adoc
index 38dd0d42e9..05af2e789b 100644
--- a/src/main/antora/modules/ROOT/pages/redis/template.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/template.adoc
@@ -1,12 +1,12 @@
[[redis:template]]
= Working with Objects through `RedisTemplate`
-Most users are likely to use `RedisTemplate` and its corresponding package, `org.springframework.data.redis.core` or its reactive variant `ReactiveRedisTemplate`.
+Most users are likely to use javadoc:org.springframework.data.redis.core.RedisTemplate[] and its corresponding package, `org.springframework.data.redis.core` or its reactive variant javadoc:org.springframework.data.redis.core.ReactiveRedisTemplate[].
The template is, in fact, the central class of the Redis module, due to its rich feature set.
The template offers a high-level abstraction for Redis interactions.
While `[Reactive]RedisConnection` offers low-level methods that accept and return binary values (`byte` arrays), the template takes care of serialization and connection management, freeing the user from dealing with such details.
-The `RedisTemplate` class implements the `RedisOperations` interface and its reactive variant `ReactiveRedisTemplate` implements `ReactiveRedisOperations`.
+The javadoc:org.springframework.data.redis.core.RedisTemplate[] class implements the javadoc:org.springframework.data.redis.core.RedisOperations[] interface and its reactive variant javadoc:org.springframework.data.redis.core.ReactiveRedisTemplate[] implements javadoc:org.springframework.data.redis.core.ReactiveRedisOperations[].
NOTE: The preferred way to reference operations on a `[Reactive]RedisTemplate` instance is through the
`[Reactive]RedisOperations` interface.
@@ -27,48 +27,48 @@ Imperative::
2+^|_Key Type Operations_
-|`GeoOperations`
+|javadoc:org.springframework.data.redis.core.GeoOperations[]
|Redis geospatial operations, such as `GEOADD`, `GEORADIUS`,...
-|`HashOperations`
+|javadoc:org.springframework.data.redis.core.HashOperations[]
|Redis hash operations
-|`HyperLogLogOperations`
+|javadoc:org.springframework.data.redis.core.HyperLogLogOperations[]
|Redis HyperLogLog operations, such as `PFADD`, `PFCOUNT`,...
-|`ListOperations`
+|javadoc:org.springframework.data.redis.core.ListOperations[]
|Redis list operations
-|`SetOperations`
+|javadoc:org.springframework.data.redis.core.SetOperations[]
|Redis set operations
-|`ValueOperations`
+|javadoc:org.springframework.data.redis.core.ValueOperations[]
|Redis string (or value) operations
-|`ZSetOperations`
+|javadoc:org.springframework.data.redis.core.ZSetOperations[]
|Redis zset (or sorted set) operations
2+^|_Key Bound Operations_
-|`BoundGeoOperations`
+|javadoc:org.springframework.data.redis.core.BoundGeoOperations[]
|Redis key bound geospatial operations
-|`BoundHashOperations`
+|javadoc:org.springframework.data.redis.core.BoundHashOperations[]
|Redis hash key bound operations
-|`BoundKeyOperations`
+|javadoc:org.springframework.data.redis.core.BoundKeyOperations[]
|Redis key bound operations
-|`BoundListOperations`
+|javadoc:org.springframework.data.redis.core.BoundListOperations[]
|Redis list key bound operations
-|`BoundSetOperations`
+|javadoc:org.springframework.data.redis.core.BoundSetOperations[]
|Redis set key bound operations
-|`BoundValueOperations`
+|javadoc:org.springframework.data.redis.core.BoundValueOperations[]
|Redis string (or value) key bound operations
-|`BoundZSetOperations`
+|javadoc:org.springframework.data.redis.core.BoundZSetOperations[]
|Redis zset (or sorted set) key bound operations
|====
@@ -82,25 +82,25 @@ Reactive::
2+^|_Key Type Operations_
-|`ReactiveGeoOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveGeoOperations[]
|Redis geospatial operations such as `GEOADD`, `GEORADIUS`, and others)
-|`ReactiveHashOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveHashOperations[]
|Redis hash operations
-|`ReactiveHyperLogLogOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveHyperLogLogOperations[]
|Redis HyperLogLog operations such as (`PFADD`, `PFCOUNT`, and others)
-|`ReactiveListOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveListOperations[]
|Redis list operations
-|`ReactiveSetOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveSetOperations[]
|Redis set operations
-|`ReactiveValueOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveValueOperations[]
|Redis string (or value) operations
-|`ReactiveZSetOperations`
+|javadoc:org.springframework.data.redis.core.ReactiveZSetOperations[]
|Redis zset (or sorted set) operations
|====
======
@@ -159,7 +159,7 @@ class MyConfig {
}
@Bean
- ReactiveRedisTemplate ReactiveRedisTemplate(ReactoveRedisConnectionFactory connectionFactory) {
+ ReactiveRedisTemplate ReactiveRedisTemplate(ReactiveRedisConnectionFactory connectionFactory) {
return new ReactiveRedisTemplate<>(connectionFactory, RedisSerializationContext.string());
}
}
@@ -355,24 +355,24 @@ In Spring Data, the conversion between the user (custom) types and raw data (and
This package contains two types of serializers that, as the name implies, take care of the serialization process:
-* Two-way serializers based on ``RedisSerializer``.
+* Two-way serializers based on javadoc:org.springframework.data.redis.serializer.RedisSerializer[].
* Element readers and writers that use `RedisElementReader` and ``RedisElementWriter``.
The main difference between these variants is that `RedisSerializer` primarily serializes to `byte[]` while readers and writers use `ByteBuffer`.
Multiple implementations are available (including two that have been already mentioned in this documentation):
-* `JdkSerializationRedisSerializer`, which is used by default for `RedisCache` and `RedisTemplate`.
+* javadoc:org.springframework.data.redis.serializer.JdkSerializationRedisSerializer[], which is used by default for javadoc:org.springframework.data.redis.cache.RedisCache[] and javadoc:org.springframework.data.redis.core.RedisTemplate[].
* the `StringRedisSerializer`.
-However, one can use `OxmSerializer` for Object/XML mapping through Spring {spring-framework-docs}/data-access.html#oxm[OXM] support or `Jackson2JsonRedisSerializer` or `GenericJackson2JsonRedisSerializer` for storing data in https://en.wikipedia.org/wiki/JSON[JSON] format.
+However, one can use `OxmSerializer` for Object/XML mapping through Spring {spring-framework-docs}/data-access.html#oxm[OXM] support or javadoc:org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer[] or javadoc:org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer[] for storing data in https://en.wikipedia.org/wiki/JSON[JSON] format.
Do note that the storage format is not limited only to values.
It can be used for keys, values, or hashes without any restrictions.
[WARNING]
====
-By default, `RedisCache` and `RedisTemplate` are configured to use Java native serialization.
+By default, javadoc:org.springframework.data.redis.cache.RedisCache[] and javadoc:org.springframework.data.redis.core.RedisTemplate[] are configured to use Java native serialization.
Java native serialization is known for allowing the running of remote code caused by payloads that exploit vulnerable libraries and classes injecting unverified bytecode.
Manipulated input could lead to unwanted code being run in the application during the deserialization step.
As a consequence, do not use serialization in untrusted environments.
diff --git a/src/main/antora/modules/ROOT/pages/redis/transactions.adoc b/src/main/antora/modules/ROOT/pages/redis/transactions.adoc
index de48a55cc5..8ba20676bc 100644
--- a/src/main/antora/modules/ROOT/pages/redis/transactions.adoc
+++ b/src/main/antora/modules/ROOT/pages/redis/transactions.adoc
@@ -2,10 +2,10 @@
= Redis Transactions
Redis provides support for https://redis.io/topics/transactions[transactions] through the `multi`, `exec`, and `discard` commands.
-These operations are available on `RedisTemplate`.
+These operations are available on javadoc:org.springframework.data.redis.core.RedisTemplate[].
However, `RedisTemplate` is not guaranteed to run all the operations in the transaction with the same connection.
-Spring Data Redis provides the `SessionCallback` interface for use when multiple operations need to be performed with the same `connection`, such as when using Redis transactions.The following example uses the `multi` method:
+Spring Data Redis provides the javadoc:org.springframework.data.redis.core.SessionCallback[] interface for use when multiple operations need to be performed with the same `connection`, such as when using Redis transactions.The following example uses the `multi` method:
[source,java]
----
diff --git a/src/main/java/org/springframework/data/redis/ClusterRedirectException.java b/src/main/java/org/springframework/data/redis/ClusterRedirectException.java
index 79a5f0632d..562347e86a 100644
--- a/src/main/java/org/springframework/data/redis/ClusterRedirectException.java
+++ b/src/main/java/org/springframework/data/redis/ClusterRedirectException.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.
@@ -15,6 +15,8 @@
*/
package org.springframework.data.redis;
+import java.io.Serial;
+
import org.springframework.dao.DataRetrievalFailureException;
/**
@@ -27,6 +29,7 @@
*/
public class ClusterRedirectException extends DataRetrievalFailureException {
+ @Serial
private static final long serialVersionUID = -857075813794333965L;
private final int slot;
@@ -43,7 +46,7 @@ public class ClusterRedirectException extends DataRetrievalFailureException {
*/
public ClusterRedirectException(int slot, String targetHost, int targetPort, Throwable e) {
- super(String.format("Redirect: slot %s to %s:%s.", slot, targetHost, targetPort), e);
+ super("Redirect: slot %s to %s:%s.".formatted(slot, targetHost, targetPort), e);
this.slot = slot;
this.host = targetHost;
diff --git a/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java b/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java
index 61ccabde15..29543870d6 100644
--- a/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java
+++ b/src/main/java/org/springframework/data/redis/ClusterStateFailureException.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.
@@ -15,6 +15,8 @@
*/
package org.springframework.data.redis;
+import java.io.Serial;
+
import org.springframework.dao.DataAccessResourceFailureException;
/**
@@ -28,6 +30,7 @@
*/
public class ClusterStateFailureException extends DataAccessResourceFailureException {
+ @Serial
private static final long serialVersionUID = 333399051713240852L;
/**
diff --git a/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java
index d5c34e9cdb..a389a4c814 100644
--- a/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java
+++ b/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.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/redis/FallbackExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/FallbackExceptionTranslationStrategy.java
index ed9728797f..58eb89e21b 100644
--- a/src/main/java/org/springframework/data/redis/FallbackExceptionTranslationStrategy.java
+++ b/src/main/java/org/springframework/data/redis/FallbackExceptionTranslationStrategy.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/redis/PassThroughExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.java
index aa4aeee609..55da37766b 100644
--- a/src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.java
+++ b/src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.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/redis/RedisConnectionFailureException.java b/src/main/java/org/springframework/data/redis/RedisConnectionFailureException.java
index 73d4fe2045..044a13126b 100644
--- a/src/main/java/org/springframework/data/redis/RedisConnectionFailureException.java
+++ b/src/main/java/org/springframework/data/redis/RedisConnectionFailureException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/RedisSystemException.java b/src/main/java/org/springframework/data/redis/RedisSystemException.java
index 50d2218dd3..64230b481f 100644
--- a/src/main/java/org/springframework/data/redis/RedisSystemException.java
+++ b/src/main/java/org/springframework/data/redis/RedisSystemException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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.
@@ -16,6 +16,7 @@
package org.springframework.data.redis;
import org.springframework.dao.UncategorizedDataAccessException;
+import org.springframework.lang.Nullable;
/**
* Exception thrown when we can't classify a Redis exception into one of Spring generic data access exceptions.
@@ -28,7 +29,7 @@ public class RedisSystemException extends UncategorizedDataAccessException {
* @param msg the detail message.
* @param cause the root cause from the data access API in use.
*/
- public RedisSystemException(String msg, Throwable cause) {
+ public RedisSystemException(String msg, @Nullable Throwable cause) {
super(msg, cause);
}
diff --git a/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java b/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java
index 6a40b28f00..e985374ae7 100644
--- a/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java
+++ b/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.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.
@@ -15,6 +15,8 @@
*/
package org.springframework.data.redis;
+import java.io.Serial;
+
import org.springframework.dao.DataRetrievalFailureException;
/**
@@ -25,6 +27,7 @@
*/
public class TooManyClusterRedirectionsException extends DataRetrievalFailureException {
+ @Serial
private static final long serialVersionUID = -2818933672669154328L;
/**
diff --git a/src/main/java/org/springframework/data/redis/aot/RedisRuntimeHints.java b/src/main/java/org/springframework/data/redis/aot/RedisRuntimeHints.java
index 0649d513e6..efa2669e3c 100644
--- a/src/main/java/org/springframework/data/redis/aot/RedisRuntimeHints.java
+++ b/src/main/java/org/springframework/data/redis/aot/RedisRuntimeHints.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/redis/cache/BatchStrategies.java b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java
index 047ef3834c..dc808e516e 100644
--- a/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java
+++ b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.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/redis/cache/BatchStrategy.java b/src/main/java/org/springframework/data/redis/cache/BatchStrategy.java
index d18db54c9a..98b3b32360 100644
--- a/src/main/java/org/springframework/data/redis/cache/BatchStrategy.java
+++ b/src/main/java/org/springframework/data/redis/cache/BatchStrategy.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/redis/cache/CacheKeyPrefix.java b/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java
index a08003f2d2..6d340afdad 100644
--- a/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java
+++ b/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/cache/CacheStatistics.java b/src/main/java/org/springframework/data/redis/cache/CacheStatistics.java
index d69d768508..7e92fa7835 100644
--- a/src/main/java/org/springframework/data/redis/cache/CacheStatistics.java
+++ b/src/main/java/org/springframework/data/redis/cache/CacheStatistics.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/CacheStatisticsCollector.java b/src/main/java/org/springframework/data/redis/cache/CacheStatisticsCollector.java
index 24b5eff794..d0ab23a6e3 100644
--- a/src/main/java/org/springframework/data/redis/cache/CacheStatisticsCollector.java
+++ b/src/main/java/org/springframework/data/redis/cache/CacheStatisticsCollector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/CacheStatisticsProvider.java b/src/main/java/org/springframework/data/redis/cache/CacheStatisticsProvider.java
index b7566f4212..2a4eed63de 100644
--- a/src/main/java/org/springframework/data/redis/cache/CacheStatisticsProvider.java
+++ b/src/main/java/org/springframework/data/redis/cache/CacheStatisticsProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/DefaultCacheStatisticsCollector.java b/src/main/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollector.java
index 6a8d5b7620..693a8e945b 100644
--- a/src/main/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollector.java
+++ b/src/main/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/DefaultRedisCacheWriter.java b/src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java
index 205487fa1b..e2b96bd497 100644
--- a/src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java
+++ b/src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -391,9 +391,7 @@ private void checkAndPotentiallyWaitUntilUnlocked(String name, RedisConnection c
// Re-interrupt current Thread to allow other participants to react.
Thread.currentThread().interrupt();
- String message = String.format("Interrupted while waiting to unlock cache %s", name);
-
- throw new PessimisticLockingFailureException(message, ex);
+ throw new PessimisticLockingFailureException("Interrupted while waiting to unlock cache %s".formatted(name), ex);
} finally {
this.statistics.incLockTime(name, System.nanoTime() - lockWaitTimeNs);
}
@@ -429,7 +427,7 @@ interface AsyncCacheWriter {
* @param name the cache name from which to retrieve the cache entry.
* @param key the cache entry key.
* @param ttl optional TTL to set for Time-to-Idle eviction.
- * @return a future that completes either with a value if the value exists or completing with {@code null} if the
+ * @return a future that completes either with a value if the value exists or completing with {@literal null} if the
* cache does not contain an entry.
*/
CompletableFuture retrieve(String name, byte[] key, @Nullable Duration ttl);
diff --git a/src/main/java/org/springframework/data/redis/cache/FixedDurationTtlFunction.java b/src/main/java/org/springframework/data/redis/cache/FixedDurationTtlFunction.java
index e0a328e878..6c456de4c8 100644
--- a/src/main/java/org/springframework/data/redis/cache/FixedDurationTtlFunction.java
+++ b/src/main/java/org/springframework/data/redis/cache/FixedDurationTtlFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-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/redis/cache/MutableCacheStatistics.java b/src/main/java/org/springframework/data/redis/cache/MutableCacheStatistics.java
index a783da8c8f..94a19b1700 100644
--- a/src/main/java/org/springframework/data/redis/cache/MutableCacheStatistics.java
+++ b/src/main/java/org/springframework/data/redis/cache/MutableCacheStatistics.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/NoOpCacheStatisticsCollector.java b/src/main/java/org/springframework/data/redis/cache/NoOpCacheStatisticsCollector.java
index 498ff82679..4180ce875d 100644
--- a/src/main/java/org/springframework/data/redis/cache/NoOpCacheStatisticsCollector.java
+++ b/src/main/java/org/springframework/data/redis/cache/NoOpCacheStatisticsCollector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/cache/RedisCache.java b/src/main/java/org/springframework/data/redis/cache/RedisCache.java
index 187add2512..756bb28192 100644
--- a/src/main/java/org/springframework/data/redis/cache/RedisCache.java
+++ b/src/main/java/org/springframework/data/redis/cache/RedisCache.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -39,7 +39,6 @@
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.util.ByteUtils;
-import org.springframework.data.redis.util.RedisAssertions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -86,8 +85,7 @@ public class RedisCache extends AbstractValueAdaptingCache {
*/
protected RedisCache(String name, RedisCacheWriter cacheWriter, RedisCacheConfiguration cacheConfiguration) {
- super(RedisAssertions.requireNonNull(cacheConfiguration, "CacheConfiguration must not be null")
- .getAllowCacheNullValues());
+ super(cacheConfiguration.getAllowCacheNullValues());
Assert.notNull(name, "Name must not be null");
Assert.notNull(cacheWriter, "CacheWriter must not be null");
@@ -318,12 +316,9 @@ private Object processAndCheckValue(@Nullable Object value) {
Object cacheValue = preProcessCacheValue(value);
if (nullCacheValueIsNotAllowed(cacheValue)) {
-
- String message = String.format("Cache '%s' does not allow 'null' values; Avoid storing null"
+ throw new IllegalArgumentException(("Cache '%s' does not allow 'null' values; Avoid storing null"
+ " via '@Cacheable(unless=\"#result == null\")' or configure RedisCache to allow 'null'"
- + " via RedisCacheConfiguration", getName());
-
- throw new IllegalArgumentException(message);
+ + " via RedisCacheConfiguration").formatted(getName()));
}
return cacheValue;
@@ -434,12 +429,9 @@ protected String convertKey(Object key) {
return key.toString();
}
- String message = String.format(
- "Cannot convert cache key %s to String; Please register a suitable Converter"
- + " via 'RedisCacheConfiguration.configureKeyConverters(...)' or override '%s.toString()'",
- source, key.getClass().getName());
-
- throw new IllegalStateException(message);
+ throw new IllegalStateException(("Cannot convert cache key %s to String; Please register a suitable Converter"
+ + " via 'RedisCacheConfiguration.configureKeyConverters(...)' or override '%s.toString()'")
+ .formatted(source, key.getClass().getName()));
}
private CompletableFuture retrieveValue(Object key) {
@@ -499,7 +491,7 @@ private String convertCollectionLikeOrMapKey(Object key, TypeDescriptor source)
return "[" + stringJoiner + "]";
}
- throw new IllegalArgumentException(String.format("Cannot convert cache key [%s] to String", key));
+ throw new IllegalArgumentException("Cannot convert cache key [%s] to String".formatted(key));
}
private byte[] createAndConvertCacheKey(Object key) {
diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
index 261c932ab2..56022f81f9 100644
--- a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -424,11 +424,9 @@ public void addCacheKeyConverter(Converter, String> cacheKeyConverter) {
public void configureKeyConverters(Consumer registryConsumer) {
if (!(getConversionService() instanceof ConverterRegistry)) {
-
- String message = "'%s' returned by getConversionService() does not allow Converter registration;"
- + " Please make sure to provide a ConversionService that implements ConverterRegistry";
-
- throw new IllegalStateException(String.format(message, getConversionService().getClass().getName()));
+ throw new IllegalStateException(("'%s' returned by getConversionService() does not allow Converter registration;"
+ + " Please make sure to provide a ConversionService that implements ConverterRegistry")
+ .formatted(getConversionService().getClass().getName()));
}
registryConsumer.accept((ConverterRegistry) getConversionService());
@@ -438,7 +436,6 @@ public void configureKeyConverters(Consumer registryConsumer)
* Registers default cache {@link Converter key converters}.
*
* The following converters get registered:
- *
*
*
{@link String} to {@link byte byte[]} using UTF-8 encoding.
*
{@link SimpleKey} to {@link String}
diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java
index 1df8208ef4..3c9e3c5415 100644
--- a/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java
+++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -27,7 +27,6 @@
import org.springframework.cache.CacheManager;
import org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.util.RedisAssertions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -103,10 +102,11 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d
private RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
boolean allowRuntimeCacheCreation) {
- this.defaultCacheConfiguration = RedisAssertions.requireNonNull(defaultCacheConfiguration,
- "DefaultCacheConfiguration must not be null");
+ Assert.notNull(defaultCacheConfiguration, "DefaultCacheConfiguration must not be null");
+ Assert.notNull(cacheWriter, "CacheWriter must not be null");
- this.cacheWriter = RedisAssertions.requireNonNull(cacheWriter, "CacheWriter must not be null");
+ this.defaultCacheConfiguration = defaultCacheConfiguration;
+ this.cacheWriter = cacheWriter;
this.initialCacheConfiguration = new LinkedHashMap<>();
this.allowRuntimeCacheCreation = allowRuntimeCacheCreation;
}
@@ -423,7 +423,10 @@ public static class RedisCacheManagerBuilder {
* @see org.springframework.data.redis.cache.RedisCacheWriter
*/
public static RedisCacheManagerBuilder fromCacheWriter(RedisCacheWriter cacheWriter) {
- return new RedisCacheManagerBuilder(RedisAssertions.requireNonNull(cacheWriter, "CacheWriter must not be null"));
+
+ Assert.notNull(cacheWriter, "CacheWriter must not be null");
+
+ return new RedisCacheManagerBuilder(cacheWriter);
}
/**
@@ -534,7 +537,10 @@ public RedisCacheManagerBuilder cacheDefaults(RedisCacheConfiguration defaultCac
* @since 2.3
*/
public RedisCacheManagerBuilder cacheWriter(RedisCacheWriter cacheWriter) {
- this.cacheWriter = RedisAssertions.requireNonNull(cacheWriter, "CacheWriter must not be null");
+
+ Assert.notNull(cacheWriter, "CacheWriter must not be null");
+
+ this.cacheWriter = cacheWriter;
return this;
}
@@ -558,8 +564,10 @@ public RedisCacheManagerBuilder enableStatistics() {
*/
public RedisCacheManagerBuilder initialCacheNames(Set cacheNames) {
- RedisAssertions.requireNonNull(cacheNames, "CacheNames must not be null")
- .forEach(it -> withCacheConfiguration(it, defaultCacheConfiguration));
+ Assert.notNull(cacheNames, "CacheNames must not be null");
+ Assert.noNullElements(cacheNames, "CacheNames must not be null");
+
+ cacheNames.forEach(it -> withCacheConfiguration(it, defaultCacheConfiguration));
return this;
}
@@ -603,9 +611,9 @@ public RedisCacheManagerBuilder withCacheConfiguration(String cacheName,
public RedisCacheManagerBuilder withInitialCacheConfigurations(
Map cacheConfigurations) {
- RedisAssertions.requireNonNull(cacheConfigurations, "CacheConfigurations must not be null")
- .forEach((cacheName, cacheConfiguration) -> RedisAssertions.requireNonNull(cacheConfiguration,
- "RedisCacheConfiguration for cache [%s] must not be null", cacheName));
+ Assert.notNull(cacheConfigurations, "CacheConfigurations must not be null!");
+ cacheConfigurations.forEach((cacheName, configuration) -> Assert.notNull(configuration,
+ String.format("RedisCacheConfiguration for cache %s must not be null!", cacheName)));
this.initialCaches.putAll(cacheConfigurations);
diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheWriter.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheWriter.java
index 04dd0e3507..57ff128890 100644
--- a/src/main/java/org/springframework/data/redis/cache/RedisCacheWriter.java
+++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -293,7 +293,7 @@ static TtlFunction persistent() {
* persistent value that does not expire.
*
* @param key the cache key.
- * @param value the cache value. Can be {@code null} if the cache supports {@code null} value caching.
+ * @param value the cache value. Can be {@literal null} if the cache supports {@literal null} value caching.
* @return the computed {@link Duration time-to-live (TTL)}. Can be {@link Duration#ZERO} for persistent values
* (i.e. cache entry does not expire).
*/
diff --git a/src/main/java/org/springframework/data/redis/config/RedisCollectionParser.java b/src/main/java/org/springframework/data/redis/config/RedisCollectionParser.java
index 6e5963eb9f..bb50defa3e 100644
--- a/src/main/java/org/springframework/data/redis/config/RedisCollectionParser.java
+++ b/src/main/java/org/springframework/data/redis/config/RedisCollectionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/config/RedisListenerContainerParser.java b/src/main/java/org/springframework/data/redis/config/RedisListenerContainerParser.java
index 7c09a8896d..c69d645e7b 100644
--- a/src/main/java/org/springframework/data/redis/config/RedisListenerContainerParser.java
+++ b/src/main/java/org/springframework/data/redis/config/RedisListenerContainerParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/config/RedisNamespaceHandler.java b/src/main/java/org/springframework/data/redis/config/RedisNamespaceHandler.java
index 256dba0ffd..5c4394020a 100644
--- a/src/main/java/org/springframework/data/redis/config/RedisNamespaceHandler.java
+++ b/src/main/java/org/springframework/data/redis/config/RedisNamespaceHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/AbstractRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java
index 7b2581973d..46a7a12ded 100644
--- a/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.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/redis/connection/BitFieldSubCommands.java b/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java
index 4e4193e982..b90121f90b 100644
--- a/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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.
@@ -151,10 +151,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof BitFieldSubCommands)) {
+ if (!(o instanceof BitFieldSubCommands that)) {
return false;
}
- BitFieldSubCommands that = (BitFieldSubCommands) o;
return ObjectUtils.nullSafeEquals(subCommands, that.subCommands);
}
@@ -437,10 +436,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof Offset)) {
+ if (!(o instanceof Offset that)) {
return false;
}
- Offset that = (Offset) o;
if (offset != that.offset) {
return false;
}
@@ -549,10 +547,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof BitFieldType)) {
+ if (!(o instanceof BitFieldType that)) {
return false;
}
- BitFieldType that = (BitFieldType) o;
if (signed != that.signed) {
return false;
}
@@ -597,10 +594,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof AbstractBitFieldSubCommand)) {
+ if (!(o instanceof AbstractBitFieldSubCommand that)) {
return false;
}
- AbstractBitFieldSubCommand that = (AbstractBitFieldSubCommand) o;
if (!ObjectUtils.nullSafeEquals(getClass(), that.getClass())) {
return false;
}
@@ -680,13 +676,12 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof BitFieldSet)) {
+ if (!(o instanceof BitFieldSet that)) {
return false;
}
if (!super.equals(o)) {
return false;
}
- BitFieldSet that = (BitFieldSet) o;
if (value != that.value) {
return false;
}
@@ -832,10 +827,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof BitFieldIncrBy)) {
+ if (!(o instanceof BitFieldIncrBy that)) {
return false;
}
- BitFieldIncrBy that = (BitFieldIncrBy) o;
if (value != that.value) {
return false;
}
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java
index 7a786b63f9..1ee5458ec3 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.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.
@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.connection;
+import java.io.Serial;
import java.util.Collections;
import java.util.List;
@@ -29,7 +30,7 @@
*/
public class ClusterCommandExecutionFailureException extends UncategorizedDataAccessException {
- private static final long serialVersionUID = 5727044227040368955L;
+ @Serial private static final long serialVersionUID = 5727044227040368955L;
/**
* Creates new {@link ClusterCommandExecutionFailureException}.
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java
index 3e896e53d9..51c8c9372d 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.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.
@@ -130,12 +130,9 @@ private NodeResult executeCommandOnSingleNode(ClusterCommandCallback this.maxRedirects) {
-
- String message = String.format("Cannot follow Cluster Redirects over more than %s legs; "
- + "Consider increasing the number of redirects to follow; Current value is: %s.",
- redirectCount, this.maxRedirects);
-
- throw new TooManyClusterRedirectionsException(message);
+ throw new TooManyClusterRedirectionsException(("Cannot follow Cluster Redirects over more than %s legs;"
+ + " Consider increasing the number of redirects to follow; Current value is: %s")
+ .formatted(redirectCount, this.maxRedirects));
}
RedisClusterNode nodeToUse = lookupNode(node);
@@ -178,7 +175,7 @@ private RedisClusterNode lookupNode(RedisClusterNode node) {
try {
return topologyProvider.getTopology().lookup(node);
} catch (ClusterStateFailureException ex) {
- throw new IllegalArgumentException(String.format("Node %s is unknown to cluster", node), ex);
+ throw new IllegalArgumentException("Node %s is unknown to cluster".formatted(node), ex);
}
}
@@ -215,7 +212,7 @@ public MultiNodeResult executeCommandAsyncOnNodes(ClusterCommandCallba
try {
resolvedRedisClusterNodes.add(topology.lookup(node));
} catch (ClusterStateFailureException ex) {
- throw new IllegalArgumentException(String.format("Node %s is unknown to cluster", node), ex);
+ throw new IllegalArgumentException("Node %s is unknown to cluster".formatted(node), ex);
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterInfo.java b/src/main/java/org/springframework/data/redis/connection/ClusterInfo.java
index e09ebbfd8d..8d6179811c 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterInfo.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterInfo.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/redis/connection/ClusterNodeResourceProvider.java b/src/main/java/org/springframework/data/redis/connection/ClusterNodeResourceProvider.java
index 454ac41d23..a12ce3f8ea 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterNodeResourceProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterNodeResourceProvider.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/redis/connection/ClusterSlotHashUtil.java b/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java
index 6494f423c7..58b49520bf 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.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/redis/connection/ClusterTopology.java b/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java
index bb82facae2..42436431f4 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterTopology.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.
@@ -141,7 +141,7 @@ public RedisClusterNode getKeyServingMasterNode(byte[] key) {
}
throw new ClusterStateFailureException(
- String.format("Could not find master node serving slot %s for key '%s',", slot, Arrays.toString(key)));
+ "Could not find master node serving slot %s for key '%s',".formatted(slot, Arrays.toString(key)));
}
/**
@@ -161,7 +161,7 @@ public RedisClusterNode lookup(String host, int port) {
}
throw new ClusterStateFailureException(
- String.format("Could not find node at %s:%s; Is your cluster info up to date", host, port));
+ "Could not find node at %s:%d; Is your cluster info up to date".formatted(host, port));
}
/**
@@ -182,7 +182,7 @@ public RedisClusterNode lookup(String nodeId) {
}
throw new ClusterStateFailureException(
- String.format("Could not find node at %s; Is your cluster info up to date", nodeId));
+ "Could not find node at %s; Is your cluster info up to date".formatted(nodeId));
}
/**
@@ -210,7 +210,7 @@ public RedisClusterNode lookup(RedisClusterNode node) {
}
throw new ClusterStateFailureException(
- String.format("Could not find node at %s; Have you provided either host and port or the nodeId", node));
+ ("Could not find node at %s;" + " Have you provided either host and port or the nodeId").formatted(node));
}
/**
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterTopologyProvider.java b/src/main/java/org/springframework/data/redis/connection/ClusterTopologyProvider.java
index 22827c1d2b..f03067e21f 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterTopologyProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterTopologyProvider.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/redis/connection/ConnectionUtils.java b/src/main/java/org/springframework/data/redis/connection/ConnectionUtils.java
index 9c768307f4..58af2c6ba1 100644
--- a/src/main/java/org/springframework/data/redis/connection/ConnectionUtils.java
+++ b/src/main/java/org/springframework/data/redis/connection/ConnectionUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DataType.java b/src/main/java/org/springframework/data/redis/connection/DataType.java
index 746eb09a9b..1b0635fbeb 100644
--- a/src/main/java/org/springframework/data/redis/connection/DataType.java
+++ b/src/main/java/org/springframework/data/redis/connection/DataType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DecoratedRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DecoratedRedisConnection.java
index 2757810c0e..19ad271389 100644
--- a/src/main/java/org/springframework/data/redis/connection/DecoratedRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DecoratedRedisConnection.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/redis/connection/DefaultMessage.java b/src/main/java/org/springframework/data/redis/connection/DefaultMessage.java
index 0ec00955e9..b96a0895f3 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultMessage.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DefaultSortParameters.java b/src/main/java/org/springframework/data/redis/connection/DefaultSortParameters.java
index 44526bd999..bd50f34ba6 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultSortParameters.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultSortParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DefaultStringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
index 80cc128e55..8fe2f2c9f7 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DefaultStringTuple.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
index 7851a0f2a8..b35522c642 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/DefaultedRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
index dfa5986df5..369a272476 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/DefaultedRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
index aaeaafe18b..aa5f6de773 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/FutureResult.java b/src/main/java/org/springframework/data/redis/connection/FutureResult.java
index 122e889798..58da880234 100644
--- a/src/main/java/org/springframework/data/redis/connection/FutureResult.java
+++ b/src/main/java/org/springframework/data/redis/connection/FutureResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/Limit.java b/src/main/java/org/springframework/data/redis/connection/Limit.java
index f47e2b6747..d6abf62b85 100644
--- a/src/main/java/org/springframework/data/redis/connection/Limit.java
+++ b/src/main/java/org/springframework/data/redis/connection/Limit.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/redis/connection/Message.java b/src/main/java/org/springframework/data/redis/connection/Message.java
index 5be91f3897..138f61f3b2 100644
--- a/src/main/java/org/springframework/data/redis/connection/Message.java
+++ b/src/main/java/org/springframework/data/redis/connection/Message.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/MessageListener.java b/src/main/java/org/springframework/data/redis/connection/MessageListener.java
index fcf894a413..4857b45c6d 100644
--- a/src/main/java/org/springframework/data/redis/connection/MessageListener.java
+++ b/src/main/java/org/springframework/data/redis/connection/MessageListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/NamedNode.java b/src/main/java/org/springframework/data/redis/connection/NamedNode.java
index a638ed5781..5ccf100762 100644
--- a/src/main/java/org/springframework/data/redis/connection/NamedNode.java
+++ b/src/main/java/org/springframework/data/redis/connection/NamedNode.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/redis/connection/PoolException.java b/src/main/java/org/springframework/data/redis/connection/PoolException.java
index 06969e9ace..1dc6b89cbb 100644
--- a/src/main/java/org/springframework/data/redis/connection/PoolException.java
+++ b/src/main/java/org/springframework/data/redis/connection/PoolException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/ReactiveClusterCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
index da4fad9d76..d780acced3 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-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/redis/connection/ReactiveClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterGeoCommands.java
index d4496375cd..ae97652ba0 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterGeoCommands.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/redis/connection/ReactiveClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHashCommands.java
index 60e2390988..6674520b33 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHashCommands.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/redis/connection/ReactiveClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHyperLogLogCommands.java
index 03df631960..2623eeda84 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterHyperLogLogCommands.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/redis/connection/ReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java
index 21aea13ba1..d650b738eb 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.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/redis/connection/ReactiveClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterListCommands.java
index ad5bf5a3dc..f331728178 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterListCommands.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/redis/connection/ReactiveClusterNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterNumberCommands.java
index 5968745c1c..3840a33b32 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterNumberCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterNumberCommands.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/redis/connection/ReactiveClusterScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterScriptingCommands.java
index b027421546..a7e0f171c7 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/ReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java
index 050715b734..2a19d5fcfe 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/ReactiveClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterSetCommands.java
index 8590edeab9..b20809fd24 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterSetCommands.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/redis/connection/ReactiveClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java
index 696958fd77..d2dacc7fad 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/connection/ReactiveClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStringCommands.java
index 3800aec877..a410627a3a 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStringCommands.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/redis/connection/ReactiveClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterZSetCommands.java
index f11a90d7cb..167d0f59b1 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterZSetCommands.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/redis/connection/ReactiveGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java
index cbeec12b28..80c9fde257 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.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/redis/connection/ReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java
index 063dd6e285..0fae8d30b8 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveHashCommands.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.
@@ -289,7 +289,7 @@ default Mono hGet(ByteBuffer key, ByteBuffer field) {
/**
* Get values for given {@literal fields} from hash at {@literal key}. Values are in the order of the requested keys.
- * Absent field values are represented using {@code null} in the resulting {@link List}.
+ * Absent field values are represented using {@literal null} in the resulting {@link List}.
*
* @param key must not be {@literal null}.
* @param fields must not be {@literal null}.
@@ -306,7 +306,7 @@ default Mono> hMGet(ByteBuffer key, Collection fiel
/**
* Get values for given {@literal fields} from hash at {@literal key}. Values are in the order of the requested keys.
- * Absent field values are represented using {@code null} in the resulting {@link List}.
+ * Absent field values are represented using {@literal null} in the resulting {@link List}.
*
* @param commands must not be {@literal null}.
* @return
diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveHyperLogLogCommands.java
index d10975851a..cba1cc8fac 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveHyperLogLogCommands.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/redis/connection/ReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java
index bd3f4d73dd..91b81640c1 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.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/redis/connection/ReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveListCommands.java
index f3fbd20f3e..d92a99a270 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveListCommands.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/redis/connection/ReactiveNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveNumberCommands.java
index bbade90af8..31f80cc460 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveNumberCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveNumberCommands.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/redis/connection/ReactivePubSubCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactivePubSubCommands.java
index d07155b4ab..5ea9d74885 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactivePubSubCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactivePubSubCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/connection/ReactiveRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisClusterConnection.java
index 2dc4efd081..cec6b7991b 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveRedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisClusterConnection.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/redis/connection/ReactiveRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnection.java
index 7da6929ad3..5dfb6d9db8 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnection.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/redis/connection/ReactiveRedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnectionFactory.java
index 05e726e753..3492913549 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/ReactiveScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveScriptingCommands.java
index 5337763728..4ad5d59004 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/ReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java
index d95b718503..c0d65c1a81 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/ReactiveSetCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveSetCommands.java
index 845301dba9..76911fd441 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveSetCommands.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/redis/connection/ReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
index 460a8cc3fe..3f1b036e04 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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.
@@ -335,7 +335,7 @@ public Long getMaxlen() {
* @since 2.3
*/
public boolean hasMaxlen() {
- return maxlen != null && maxlen > 0;
+ return maxlen != null;
}
/**
@@ -654,7 +654,7 @@ default Mono xPending(ByteBuffer key, String groupName)
Assert.notNull(key, "Key must not be null");
Assert.notNull(groupName, "GroupName must not be null");
- return xPendingSummary(Mono.just(new PendingRecordsCommand(key, groupName, null, Range.unbounded(), null))).next()
+ return xPendingSummary(Mono.just(PendingRecordsCommand.pending(key, groupName))).next()
.map(CommandResponse::getOutput);
}
@@ -695,7 +695,7 @@ default Mono xPending(ByteBuffer key, Consumer consumer) {
*/
@Nullable
default Mono xPending(ByteBuffer key, String groupName, String consumerName) {
- return xPending(Mono.just(new PendingRecordsCommand(key, groupName, consumerName, Range.unbounded(), null))).next()
+ return xPending(Mono.just(PendingRecordsCommand.pending(key, groupName).consumer(consumerName))).next()
.map(CommandResponse::getOutput);
}
@@ -712,7 +712,7 @@ default Mono xPending(ByteBuffer key, String groupName, String
* @since 2.3
*/
default Mono xPending(ByteBuffer key, String groupName, Range> range, Long count) {
- return xPending(Mono.just(new PendingRecordsCommand(key, groupName, null, range, count))).next()
+ return xPending(Mono.just(PendingRecordsCommand.pending(key, groupName).range(range, count))).next()
.map(CommandResponse::getOutput);
}
@@ -748,8 +748,8 @@ default Mono xPending(ByteBuffer key, Consumer consumer, Range<
*/
default Mono xPending(ByteBuffer key, String groupName, String consumerName, Range> range,
Long count) {
- return xPending(Mono.just(new PendingRecordsCommand(key, groupName, consumerName, range, count))).next()
- .map(CommandResponse::getOutput);
+ return xPending(Mono.just(PendingRecordsCommand.pending(key, groupName).consumer(consumerName).range(range, count)))
+ .next().map(CommandResponse::getOutput);
}
/**
@@ -801,9 +801,15 @@ static PendingRecordsCommand pending(ByteBuffer key, String groupName) {
/**
* Create new {@link PendingRecordsCommand} with given {@link Range} and limit.
*
+ * @param range must not be {@literal null}.
+ * @param count the max number of messages to return. Must not be negative.
* @return new instance of {@link XPendingOptions}.
*/
- public PendingRecordsCommand range(Range range, Long count) {
+ public PendingRecordsCommand range(Range> range, Long count) {
+
+ Assert.notNull(range, "Range must not be null");
+ Assert.isTrue(count > -1, "Count must not be negative");
+
return new PendingRecordsCommand(getKey(), groupName, consumerName, range, count);
}
@@ -855,7 +861,7 @@ public boolean hasConsumer() {
* @return {@literal true} count is set.
*/
public boolean isLimited() {
- return count != null && count > -1;
+ return count != null;
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveStringCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveStringCommands.java
index 493b055dae..ab324fb46e 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveStringCommands.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.
@@ -350,7 +350,7 @@ default Mono getSet(ByteBuffer key, ByteBuffer value) {
/**
* Get multiple values in one batch. Values are in the order of the requested keys. Absent field values are
- * represented using {@code null} in the resulting {@link List}.
+ * represented using {@literal null} in the resulting {@link List}.
*
* @param keys must not be {@literal null}.
* @return
@@ -365,7 +365,7 @@ default Mono> mGet(List keys) {
/**
* Get multiple values at for {@literal keysets} in batches. Values are in the order of the requested keys. Absent
- * field values are represented using {@code null} in the resulting {@link List}.
+ * field values are represented using {@literal null} in the resulting {@link List}.
*
* @param keysets must not be {@literal null}.
* @return
diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java b/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java
index 2929544c97..153d139e8f 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/connection/ReactiveZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java
index 2abbb212ce..5400250eb9 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.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/redis/connection/RedisClusterCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java
index 9a47dd7413..018a78b6cb 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.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/redis/connection/RedisClusterCommandsProvider.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommandsProvider.java
index 7427559004..e26842e779 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterCommandsProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterCommandsProvider.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/redis/connection/RedisClusterConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterConfiguration.java
index 620e132d02..dd50159160 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterConfiguration.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.
@@ -25,7 +25,6 @@
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.data.redis.connection.RedisConfiguration.ClusterConfiguration;
-import org.springframework.data.redis.util.RedisAssertions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.NumberUtils;
@@ -161,7 +160,10 @@ public Set getClusterNodes() {
* @param node must not be {@literal null}.
*/
public void addClusterNode(RedisNode node) {
- this.clusterNodes.add(RedisAssertions.requireNonNull(node, "ClusterNode must not be null"));
+
+ Assert.notNull(node, "ClusterNode must not be null");
+
+ this.clusterNodes.add(node);
}
/**
@@ -211,7 +213,10 @@ public String getUsername() {
@Override
public void setPassword(RedisPassword password) {
- this.password = RedisAssertions.requireNonNull(password, "RedisPassword must not be null");
+
+ Assert.notNull(password, "RedisPassword must not be null");
+
+ this.password = password;
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterConnection.java
index d079fae2f3..585780ecb1 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterConnection.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/redis/connection/RedisClusterNode.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java
index 7f84a2110d..7a6443d484 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.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.
@@ -22,7 +22,6 @@
import java.util.LinkedHashSet;
import java.util.Set;
-import org.springframework.data.redis.util.RedisAssertions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
@@ -76,7 +75,9 @@ public RedisClusterNode(String id) {
this(SlotRange.empty());
- this.id = RedisAssertions.requireNonNull(id, "Id must not be null");
+ Assert.notNull(id, "Id must not be null");
+
+ this.id = id;
}
/**
@@ -86,8 +87,10 @@ public RedisClusterNode(String id) {
*/
public RedisClusterNode(SlotRange slotRange) {
+ Assert.notNull(slotRange, "SlotRange must not be null");
+
this.flags = Collections.emptySet();
- this.slotRange = RedisAssertions.requireNonNull(slotRange,"SlotRange must not be null");
+ this.slotRange = slotRange;
}
/**
@@ -101,8 +104,10 @@ public RedisClusterNode(String host, int port, SlotRange slotRange) {
super(host, port);
+ Assert.notNull(slotRange, "SlotRange must not be null");
+
this.flags = Collections.emptySet();
- this.slotRange = RedisAssertions.requireNonNull(slotRange,"SlotRange must not be null");
+ this.slotRange = slotRange;
}
/**
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java
index 0802c5a7ac..1bcac4c1f7 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/RedisCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisCommands.java
index 2b60126aad..1ebb48b83f 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisCommandsProvider.java b/src/main/java/org/springframework/data/redis/connection/RedisCommandsProvider.java
index 0a1c7a18ed..24cfc387f9 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisCommandsProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisCommandsProvider.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/redis/connection/RedisConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisConfiguration.java
index 395ccfc85f..053ce917de 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/connection/RedisConnection.java b/src/main/java/org/springframework/data/redis/connection/RedisConnection.java
index b3021e64ef..69917d5391 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisConnectionCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisConnectionCommands.java
index 704da97a77..74875a4bb2 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisConnectionCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisConnectionCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/RedisConnectionFactory.java
index 88f74d8a56..d694630701 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisGeoCommands.java
index 815363f36c..fce11eb2f6 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisGeoCommands.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/redis/connection/RedisHashCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java
index 8642fc837e..6385c56a57 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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.
@@ -69,7 +69,7 @@ public interface RedisHashCommands {
/**
* Get values for given {@code fields} from hash at {@code key}. Values are in the order of the requested keys Absent
- * field values are represented using {@code null} in the resulting {@link List}.
+ * field values are represented using {@literal null} in the resulting {@link List}.
*
* @param key must not be {@literal null}.
* @param fields must not be {@literal empty}.
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisHyperLogLogCommands.java
index de24aff2d7..67fa08a4ad 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisHyperLogLogCommands.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/redis/connection/RedisInvalidSubscriptionException.java b/src/main/java/org/springframework/data/redis/connection/RedisInvalidSubscriptionException.java
index 0af5905aec..d638a90de7 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisInvalidSubscriptionException.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisInvalidSubscriptionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java
index ceaf0025be..414f178d92 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisListCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
index 8d174c89b8..18852d2f17 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisNode.java b/src/main/java/org/springframework/data/redis/connection/RedisNode.java
index ad6841054f..06481787fd 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisNode.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisNode.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.
@@ -102,11 +102,11 @@ public static RedisNode fromString(String hostPortString) {
try {
port = Integer.parseInt(portString);
} catch (RuntimeException ignore) {
- throw new IllegalArgumentException(String.format("Unparseable port number: %s", hostPortString));
+ throw new IllegalArgumentException("Unparseable port number: %s".formatted(hostPortString));
}
if (!isValidPort(port)) {
- throw new IllegalArgumentException(String.format("Port number out of range: %s", hostPortString));
+ throw new IllegalArgumentException("Port number out of range: %s".formatted(hostPortString));
}
return new RedisNode(host, port);
@@ -123,14 +123,14 @@ private static String[] getHostAndPortFromBracketedHost(String hostPortString) {
if (hostPortString.charAt(0) != '[') {
throw new IllegalArgumentException(
- String.format("Bracketed host-port string must start with a bracket: %s", hostPortString));
+ "Bracketed host-port string must start with a bracket: %s".formatted(hostPortString));
}
int colonIndex = hostPortString.indexOf(':');
int closeBracketIndex = hostPortString.lastIndexOf(']');
if (!(colonIndex > -1 && closeBracketIndex > colonIndex)) {
- throw new IllegalArgumentException(String.format("Invalid bracketed host/port: %s", hostPortString));
+ throw new IllegalArgumentException("Invalid bracketed host/port: %s".formatted(hostPortString));
}
String host = hostPortString.substring(1, closeBracketIndex);
@@ -138,12 +138,11 @@ private static String[] getHostAndPortFromBracketedHost(String hostPortString) {
return new String[] { host, "" };
} else {
if (!(hostPortString.charAt(closeBracketIndex + 1) == ':')) {
- throw new IllegalArgumentException(
- String.format("Only a colon may follow a close bracket: %s", hostPortString));
+ throw new IllegalArgumentException("Only a colon may follow a close bracket: %s".formatted(hostPortString));
}
for (int i = closeBracketIndex + 2; i < hostPortString.length(); ++i) {
if (!Character.isDigit(hostPortString.charAt(i))) {
- throw new IllegalArgumentException(String.format("Port must be numeric: %s", hostPortString));
+ throw new IllegalArgumentException("Port must be numeric: %s".formatted(hostPortString));
}
}
return new String[] { host, hostPortString.substring(closeBracketIndex + 2) };
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java
index 89c8713ea9..3fcb4ce343 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -140,7 +140,7 @@ public Optional toOptional() {
@Override
public String toString() {
- return String.format("%s[%s]", getClass().getSimpleName(), isPresent() ? "*****" : "");
+ return "%s[%s]".formatted(getClass().getSimpleName(), isPresent() ? "*****" : "");
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisPipelineException.java b/src/main/java/org/springframework/data/redis/connection/RedisPipelineException.java
index 9a6e31ca16..0f4cd4c9e5 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisPipelineException.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisPipelineException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisPubSubCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisPubSubCommands.java
index 6f25eb7daa..00283e80ce 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisPubSubCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisPubSubCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisScriptingCommands.java
index 1fd9e96afd..ce54c205cd 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-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/redis/connection/RedisSentinelCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisSentinelCommands.java
index 25f3fb666f..0a3882e643 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSentinelCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSentinelCommands.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/redis/connection/RedisSentinelConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java
index 24b390724d..9ed211fdda 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConfiguration.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.
@@ -150,7 +150,7 @@ public RedisSentinelConfiguration(PropertySource> propertySource) {
try {
database = Integer.parseInt(databaseSource);
} catch (NumberFormatException ex) {
- throw new IllegalArgumentException(String.format("Invalid DB index '%s'; integer required", databaseSource));
+ throw new IllegalArgumentException("Invalid DB index '%s'; integer required".formatted(databaseSource));
}
this.setDatabase(database);
}
@@ -266,7 +266,7 @@ public int getDatabase() {
@Override
public void setDatabase(int index) {
- Assert.isTrue(index >= 0, () -> String.format("Invalid DB index '%d'; non-negative index required", index));
+ Assert.isTrue(index >= 0, "Invalid DB index '%d'; non-negative index required".formatted(index));
this.database = index;
}
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisSentinelConnection.java b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConnection.java
index 0d84cc2107..34f0db6003 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSentinelConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSentinelConnection.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/redis/connection/RedisServer.java b/src/main/java/org/springframework/data/redis/connection/RedisServer.java
index 1a8b306c45..bd363598c6 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisServer.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisServer.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/redis/connection/RedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java
index 26a610e05c..f21e6281fd 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisSetCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java
index bd3e75deb8..26dcb1976f 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisSocketConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisSocketConfiguration.java
index 7e70cfdfd4..e48799a659 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSocketConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSocketConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -74,7 +74,7 @@ public int getDatabase() {
@Override
public void setDatabase(int index) {
- Assert.isTrue(index >= 0, () -> String.format("Invalid DB index '%s' (a positive index required)", index));
+ Assert.isTrue(index >= 0, () -> "Invalid DB index '%s'; non-negative index required".formatted(index));
this.database = index;
}
@@ -108,10 +108,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RedisSocketConfiguration)) {
+ if (!(o instanceof RedisSocketConfiguration that)) {
return false;
}
- RedisSocketConfiguration that = (RedisSocketConfiguration) o;
if (database != that.database) {
return false;
}
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java
index 0ec52a6b70..8acb2a3be8 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -70,7 +70,7 @@ public RedisStandaloneConfiguration(String hostName, int port) {
Assert.hasText(hostName, "Host name must not be null or empty");
Assert.isTrue(port >= 1 && port <= 65535,
- () -> String.format("Port %d must be a valid TCP port in the range between 1-65535", port));
+ "Port %d must be a valid TCP port in the range between 1-65535".formatted(port));
this.hostName = hostName;
this.port = port;
@@ -103,7 +103,7 @@ public int getDatabase() {
@Override
public void setDatabase(int index) {
- Assert.isTrue(index >= 0, () -> String.format("Invalid DB index '%s' (a positive index required)", index));
+ Assert.isTrue(index >= 0, "Invalid DB index '%d'; non-negative index required".formatted(index));
this.database = index;
}
@@ -137,10 +137,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RedisStandaloneConfiguration)) {
+ if (!(o instanceof RedisStandaloneConfiguration that)) {
return false;
}
- RedisStandaloneConfiguration that = (RedisStandaloneConfiguration) o;
if (port != that.port) {
return false;
}
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisStaticMasterReplicaConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisStaticMasterReplicaConfiguration.java
index 6ed05903b1..66dd6f6051 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisStaticMasterReplicaConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisStaticMasterReplicaConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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.
@@ -118,7 +118,7 @@ public int getDatabase() {
@Override
public void setDatabase(int index) {
- Assert.isTrue(index >= 0, () -> String.format("Invalid DB index '%s' (a positive index required)", index));
+ Assert.isTrue(index >= 0, "Invalid DB index '%d'; non-negative index required".formatted(index));
this.database = index;
this.nodes.forEach(it -> it.setDatabase(database));
@@ -159,10 +159,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RedisStaticMasterReplicaConfiguration)) {
+ if (!(o instanceof RedisStaticMasterReplicaConfiguration that)) {
return false;
}
- RedisStaticMasterReplicaConfiguration that = (RedisStaticMasterReplicaConfiguration) o;
if (database != that.database) {
return false;
}
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisStreamCommands.java
index a326106610..8385d70d34 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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.
@@ -214,7 +214,7 @@ public Long getMaxlen() {
* @return {@literal true} if {@literal MAXLEN} is set.
*/
public boolean hasMaxlen() {
- return maxlen != null && maxlen > 0;
+ return maxlen != null;
}
/**
@@ -246,10 +246,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof XAddOptions)) {
+ if (!(o instanceof XAddOptions that)) {
return false;
}
- XAddOptions that = (XAddOptions) o;
if (nomkstream != that.nomkstream) {
return false;
}
@@ -789,19 +788,28 @@ public static XPendingOptions unbounded() {
/**
* Create new {@link XPendingOptions} with an unbounded {@link Range} ({@literal - +}).
*
- * @param count the max number of messages to return. Must not be {@literal null}.
+ * @param count the max number of messages to return. Must not be negative.
* @return new instance of {@link XPendingOptions}.
*/
public static XPendingOptions unbounded(Long count) {
+
+ Assert.isTrue(count > -1, "Count must not be negative");
+
return new XPendingOptions(null, Range.unbounded(), count);
}
/**
* Create new {@link XPendingOptions} with given {@link Range} and limit.
*
+ * @param range must not be {@literal null}.
+ * @param count the max number of messages to return. Must not be negative.
* @return new instance of {@link XPendingOptions}.
*/
public static XPendingOptions range(Range> range, Long count) {
+
+ Assert.notNull(range, "Range must not be null");
+ Assert.isTrue(count > -1, "Count must not be negative");
+
return new XPendingOptions(null, range, count);
}
@@ -849,7 +857,7 @@ public boolean hasConsumer() {
* @return {@literal true} count is set.
*/
public boolean isLimited() {
- return count != null && count > -1;
+ return count != null;
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisStringCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisStringCommands.java
index beac673984..007bbc774c 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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.
@@ -86,10 +86,10 @@ enum BitOperation {
/**
* Get multiple {@code keys}. Values are in the order of the requested keys Absent field values are represented using
- * {@code null} in the resulting {@link List}.
+ * {@literal null} in the resulting {@link List}.
*
* @param keys must not be {@literal null}.
- * @return {@code null} when used in pipeline / transaction.
+ * @return {@literal null} when used in pipeline / transaction.
* @see Redis Documentation: MGET
*/
@Nullable
diff --git a/src/main/java/org/springframework/data/redis/connection/RedisSubscribedConnectionException.java b/src/main/java/org/springframework/data/redis/connection/RedisSubscribedConnectionException.java
index 56ce5a9f35..846a935c4d 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisSubscribedConnectionException.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisSubscribedConnectionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisTxCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisTxCommands.java
index 8e3578dbc2..56ad3634ea 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisTxCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisTxCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/RedisZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisZSetCommands.java
index 8578d688f6..6ad0ecd59b 100644
--- a/src/main/java/org/springframework/data/redis/connection/RedisZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/RedisZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/ReturnType.java b/src/main/java/org/springframework/data/redis/connection/ReturnType.java
index 5ed9e24dbf..2ba37e2ab9 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReturnType.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReturnType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/SentinelMasterId.java b/src/main/java/org/springframework/data/redis/connection/SentinelMasterId.java
index e5d72b171c..ce778884d7 100644
--- a/src/main/java/org/springframework/data/redis/connection/SentinelMasterId.java
+++ b/src/main/java/org/springframework/data/redis/connection/SentinelMasterId.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.
@@ -51,10 +51,9 @@ public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof SentinelMasterId)) {
+ if (!(o instanceof SentinelMasterId that)) {
return false;
}
- SentinelMasterId that = (SentinelMasterId) o;
return ObjectUtils.nullSafeEquals(name, that.name);
}
diff --git a/src/main/java/org/springframework/data/redis/connection/SortParameters.java b/src/main/java/org/springframework/data/redis/connection/SortParameters.java
index b90d56c6a9..27804b98fe 100644
--- a/src/main/java/org/springframework/data/redis/connection/SortParameters.java
+++ b/src/main/java/org/springframework/data/redis/connection/SortParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/StringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
index e198eecfd3..2c286ce97e 100644
--- a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/Subscription.java b/src/main/java/org/springframework/data/redis/connection/Subscription.java
index 8fbbb32239..96510df79c 100644
--- a/src/main/java/org/springframework/data/redis/connection/Subscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/Subscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/SubscriptionListener.java b/src/main/java/org/springframework/data/redis/connection/SubscriptionListener.java
index 5049ef2423..8d9e9d6b00 100644
--- a/src/main/java/org/springframework/data/redis/connection/SubscriptionListener.java
+++ b/src/main/java/org/springframework/data/redis/connection/SubscriptionListener.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/redis/connection/ValueEncoding.java b/src/main/java/org/springframework/data/redis/connection/ValueEncoding.java
index 1185756bf3..b0d573639a 100644
--- a/src/main/java/org/springframework/data/redis/connection/ValueEncoding.java
+++ b/src/main/java/org/springframework/data/redis/connection/ValueEncoding.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2024 the original author or authors.
+ * Copyright 2018-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/redis/connection/convert/Converters.java b/src/main/java/org/springframework/data/redis/connection/convert/Converters.java
index 98ec282faf..2d4eb2cb59 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/Converters.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/Converters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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.
@@ -20,11 +20,10 @@
import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResult;
@@ -63,6 +62,7 @@
* @author daihuabin
* @author John Blum
* @author Sorokin Evgeniy
+ * @author Marcin Grzejszczak
*/
public abstract class Converters {
@@ -410,7 +410,7 @@ public static Object parse(Object source, String sourcePath, Map {
*
{@code %s:%i} (Redis 3)
*
{@code %s:%i@%i} (Redis 4, with bus port)
*
{@code %s:%i@%i,%s} (Redis 7, with announced hostname)
+ *
+ * The output of the {@code CLUSTER NODES } command is just a space-separated CSV string, where each
+ * line represents a node in the cluster. The following is an example of output on Redis 7.2.0.
+ * You can check the latest here.
+ *
+ * {@code ... }
+ *
*
*/
- static final Pattern clusterEndpointPattern = Pattern
- .compile("\\[?([0-9a-zA-Z\\-_\\.:]*)\\]?:([0-9]+)(?:@[0-9]+(?:,([^,].*))?)?");
private static final Map flagLookupMap;
static {
@@ -567,32 +572,88 @@ enum ClusterNodesConverter implements Converter {
static final int LINK_STATE_INDEX = 7;
static final int SLOTS_INDEX = 8;
+ /**
+ * Value object capturing Redis' representation of a cluster node network coordinate.
+ *
+ * @author Marcin Grzejszczak
+ * @author Mark Paluch
+ */
+ record AddressPortHostname(String address, String port, @Nullable String hostname) {
+
+ /**
+ * Parses Redis {@code CLUSTER NODES} host and port segment into {@link AddressPortHostname}.
+ */
+ static AddressPortHostname parse(String hostAndPortPart) {
+
+ String[] segments = hostAndPortPart.split(",");
+ int portSeparator = segments[0].lastIndexOf(":");
+ Assert.isTrue(portSeparator != -1, "ClusterNode information does not define host and port");
+
+ String addressPart = getAddressPart(segments[0].substring(0, portSeparator));
+ String portPart = getPortPart(segments[0].substring(portSeparator + 1));
+ String hostnamePart = segments.length > 1 ? segments[1] : null;
+
+ return new AddressPortHostname(addressPart, portPart, hostnamePart);
+ }
+
+ private static String getAddressPart(String address) {
+ return address.startsWith("[") && address.endsWith("]") ? address.substring(1, address.length() - 1) : address;
+ }
+
+ private static String getPortPart(String segment) {
+
+ if (segment.contains("@")) {
+ return segment.substring(0, segment.indexOf('@'));
+ }
+
+ if (segment.contains(":")) {
+ return segment.substring(0, segment.indexOf(':'));
+ }
+
+ return segment;
+ }
+
+ public int portAsInt() {
+ return Integer.parseInt(port());
+ }
+
+ public boolean hasHostname() {
+ return StringUtils.hasText(hostname());
+ }
+
+ public String getRequiredHostname() {
+
+ if (StringUtils.hasText(hostname())) {
+ return hostname();
+ }
+
+ throw new IllegalStateException("Hostname not available");
+ }
+ }
+
@Override
public RedisClusterNode convert(String source) {
String[] args = source.split(" ");
- Matcher matcher = clusterEndpointPattern.matcher(args[HOST_PORT_INDEX]);
+ Assert.isTrue(args.length >= MASTER_ID_INDEX + 1,
+ () -> "Invalid ClusterNode information, insufficient segments: %s".formatted(source));
- Assert.isTrue(matcher.matches(), "ClusterNode information does not define host and port");
-
- String addressPart = matcher.group(1);
- String portPart = matcher.group(2);
- String hostnamePart = matcher.group(3);
+ AddressPortHostname endpoint = AddressPortHostname.parse(args[HOST_PORT_INDEX]);
SlotRange range = parseSlotRange(args);
- Set flags = parseFlags(args);
+ Set flags = parseFlags(args[FLAGS_INDEX]);
RedisClusterNodeBuilder nodeBuilder = RedisClusterNode.newRedisClusterNode()
- .listeningAt(addressPart, Integer.parseInt(portPart)) //
+ .listeningAt(endpoint.address(), endpoint.portAsInt()) //
.withId(args[ID_INDEX]) //
.promotedAs(flags.contains(Flag.MASTER) ? NodeType.MASTER : NodeType.REPLICA) //
.serving(range) //
.withFlags(flags) //
.linkState(parseLinkState(args));
- if (hostnamePart != null) {
- nodeBuilder.withName(hostnamePart);
+ if (endpoint.hasHostname()) {
+ nodeBuilder.withName(endpoint.getRequiredHostname());
}
if (!args[MASTER_ID_INDEX].isEmpty() && !args[MASTER_ID_INDEX].startsWith("-")) {
@@ -602,14 +663,12 @@ public RedisClusterNode convert(String source) {
return nodeBuilder.build();
}
- private Set parseFlags(String[] args) {
-
- String raw = args[FLAGS_INDEX];
+ private Set parseFlags(String source) {
Set flags = new LinkedHashSet<>(8, 1);
- if (StringUtils.hasText(raw)) {
- for (String flag : raw.split(",")) {
+ if (StringUtils.hasText(source)) {
+ for (String flag : source.split(",")) {
flags.add(flagLookupMap.get(flag));
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/convert/ListConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/ListConverter.java
index d9b87a8c86..1a384f1af7 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/ListConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/ListConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/LongToBooleanConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/LongToBooleanConverter.java
index 0e708780bc..8686258820 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/LongToBooleanConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/LongToBooleanConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/MapConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/MapConverter.java
index 2d9bafca65..1f09154cba 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/MapConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/MapConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/MapToPropertiesConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/MapToPropertiesConverter.java
index 2e1e93e155..b25e587e0a 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/MapToPropertiesConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/MapToPropertiesConverter.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/redis/connection/convert/SetConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/SetConverter.java
index 244306125e..c51002e368 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/SetConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/SetConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/StringToDataTypeConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/StringToDataTypeConverter.java
index 2d1ea32cc3..39214821ca 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/StringToDataTypeConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/StringToDataTypeConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/StringToPropertiesConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/StringToPropertiesConverter.java
index 7f8889eabc..16725f049c 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/StringToPropertiesConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/StringToPropertiesConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/convert/StringToRedisClientInfoConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/StringToRedisClientInfoConverter.java
index d2bf3aa39e..4c01ddfe6a 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/StringToRedisClientInfoConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/StringToRedisClientInfoConverter.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/redis/connection/convert/TransactionResultConverter.java b/src/main/java/org/springframework/data/redis/connection/convert/TransactionResultConverter.java
index 883ceb9e15..2655245ceb 100644
--- a/src/main/java/org/springframework/data/redis/connection/convert/TransactionResultConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/convert/TransactionResultConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/jedis/DefaultJedisClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java
index 50fd68211e..301b0fecdf 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientConfiguration.java
index 1c9628db0c..887b78b1f6 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClientUtils.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientUtils.java
index af7707d9ae..ab8d1d072b 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientUtils.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClientUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java
index 5b68de45e9..e3975a22c2 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.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.
@@ -20,6 +20,8 @@
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.JedisClusterInfoCache;
+import redis.clients.jedis.Protocol;
import redis.clients.jedis.providers.ClusterConnectionProvider;
import java.time.Duration;
@@ -761,14 +763,19 @@ public Jedis getResourceForSpecificNode(RedisClusterNode node) {
return new Jedis(connection);
}
- throw new DataAccessResourceFailureException(String.format("Node %s is unknown to cluster", node));
+ throw new DataAccessResourceFailureException("Node %s is unknown to cluster".formatted(node));
}
+ @Nullable
private ConnectionPool getResourcePoolForSpecificNode(RedisClusterNode node) {
Map clusterNodes = cluster.getClusterNodes();
- if (clusterNodes.containsKey(node.asString())) {
- return clusterNodes.get(node.asString());
+ HostAndPort hap = new HostAndPort(node.getHost(),
+ node.getPort() == null ? Protocol.DEFAULT_PORT : node.getPort());
+ String key = JedisClusterInfoCache.getNodeKey(hap);
+
+ if (clusterNodes.containsKey(key)) {
+ return clusterNodes.get(key);
}
return null;
@@ -779,8 +786,8 @@ private Connection getConnectionForSpecificNode(RedisClusterNode node) {
RedisClusterNode member = topologyProvider.getTopology().lookup(node);
if (!member.hasValidHost()) {
- throw new DataAccessResourceFailureException(String
- .format("Cannot obtain connection to node %ss as it is not associated with a hostname", node.getId()));
+ throw new DataAccessResourceFailureException(
+ "Cannot obtain connection to node %ss; " + "it is not associated with a hostname".formatted(node.getId()));
}
if (member != null && connectionHandler != null) {
@@ -805,13 +812,11 @@ public void returnResourceForSpecificNode(RedisClusterNode node, Object client)
*/
public static class JedisClusterTopologyProvider implements ClusterTopologyProvider {
- private long time = 0;
+ private final JedisCluster cluster;
private final long cacheTimeMs;
- private @Nullable ClusterTopology cached;
-
- private final JedisCluster cluster;
+ private volatile @Nullable JedisClusterTopology cached;
/**
* Create new {@link JedisClusterTopologyProvider}. Uses a default cache timeout of 100 milliseconds.
@@ -842,12 +847,12 @@ public JedisClusterTopologyProvider(JedisCluster cluster, Duration cacheTimeout)
@Override
public ClusterTopology getTopology() {
- if (cached != null && shouldUseCachedValue()) {
- return cached;
+ JedisClusterTopology topology = cached;
+ if (shouldUseCachedValue()) { // retain method call behaviour
+ return topology;
}
Map errors = new LinkedHashMap<>();
-
List> list = new ArrayList<>(cluster.getClusterNodes().entrySet());
Collections.shuffle(list);
@@ -856,13 +861,9 @@ public ClusterTopology getTopology() {
try (Connection connection = entry.getValue().getResource()) {
- time = System.currentTimeMillis();
-
Set nodes = Converters.toSetOfRedisClusterNodes(new Jedis(connection).clusterNodes());
-
- cached = new ClusterTopology(nodes);
-
- return cached;
+ topology = cached = new JedisClusterTopology(nodes, System.currentTimeMillis(), cacheTimeMs);
+ return topology;
} catch (Exception ex) {
errors.put(entry.getKey(), ex);
@@ -872,7 +873,7 @@ public ClusterTopology getTopology() {
StringBuilder stringBuilder = new StringBuilder();
for (Entry entry : errors.entrySet()) {
- stringBuilder.append(String.format("\r\n\t- %s failed: %s", entry.getKey(), entry.getValue().getMessage()));
+ stringBuilder.append("\r\n\t- %s failed: %s".formatted(entry.getKey(), entry.getValue().getMessage()));
}
throw new ClusterStateFailureException(
@@ -887,9 +888,54 @@ public ClusterTopology getTopology() {
* topology.
* @see #JedisClusterTopologyProvider(JedisCluster, Duration)
* @since 2.2
+ * @deprecated since 3.3.4, use {@link #shouldUseCachedValue(JedisClusterTopology)} instead.
*/
+ @Deprecated(since = "3.3.4", forRemoval = true)
protected boolean shouldUseCachedValue() {
- return time + cacheTimeMs > System.currentTimeMillis();
+ return shouldUseCachedValue(cached);
+ }
+
+ /**
+ * Returns whether {@link #getTopology()} should return the cached {@link JedisClusterTopology}. Uses a time-based
+ * caching.
+ *
+ * @return {@literal true} to use the cached {@link ClusterTopology}; {@literal false} to fetch a new cluster
+ * topology.
+ * @see #JedisClusterTopologyProvider(JedisCluster, Duration)
+ * @since 3.3.4
+ */
+ protected boolean shouldUseCachedValue(@Nullable JedisClusterTopology topology) {
+ return topology != null && topology.getMaxTime() > System.currentTimeMillis();
+ }
+ }
+
+ protected static class JedisClusterTopology extends ClusterTopology {
+
+ private final long time;
+ private final long timeoutMs;
+
+ JedisClusterTopology(Set nodes, long creationTimeMs, long timeoutMs) {
+ super(nodes);
+ this.time = creationTimeMs;
+ this.timeoutMs = timeoutMs;
+ }
+
+ /**
+ * Get the time in ms when the {@link ClusterTopology} was captured.
+ *
+ * @return ClusterTopology time.
+ */
+ public long getTime() {
+ return time;
+ }
+
+ /**
+ * Get the maximum time in ms the {@link ClusterTopology} should be used before a refresh is required.
+ *
+ * @return ClusterTopology maximum age.
+ */
+ long getMaxTime() {
+ return time + timeoutMs;
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterGeoCommands.java
index 1d98726325..35c7db73f3 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHashCommands.java
index 1803da058a..47ad6c6eec 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHyperLogLogCommands.java
index 87fdfc25d9..dd77b33f58 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterKeyCommands.java
index f431d362ec..cb1b07e9c3 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java
index 81f93645b8..3b259f36e1 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterScriptingCommands.java
index 727c4536d9..9e845f032e 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java
index c0b61ae75d..1c6045faf9 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -347,10 +347,11 @@ public Long time(RedisClusterNode node, TimeUnit timeUnit) {
public void killClient(String host, int port) {
Assert.hasText(host, "Host for 'CLIENT KILL' must not be 'null' or 'empty'");
- String hostAndPort = String.format("%s:%s", host, port);
+ String hostAndPort = "%s:%d".formatted(host, port);
- connection.getClusterCommandExecutor()
- .executeCommandOnAllNodes((JedisClusterCommandCallback) client -> client.clientKill(hostAndPort));
+ JedisClusterCommandCallback command = client -> client.clientKill(hostAndPort);
+
+ connection.getClusterCommandExecutor().executeCommandOnAllNodes(command);
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterSetCommands.java
index 4be0422e03..c25def525f 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java
index 05cadae499..9d26a6cd8d 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.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/redis/connection/jedis/JedisClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStringCommands.java
index 514ce81579..ba02de01a0 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java
index 156fb87fb5..b7bc9b5f92 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -908,8 +908,9 @@ public Set zInterWithScores(Aggregate aggregate, Weights weights, byte[].
Assert.notNull(sets, "Sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ () -> "The number of weights %d must match the number of source sets %d".formatted(weights.size(),
+ sets.length));
if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) {
@@ -951,8 +952,8 @@ public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, by
Assert.notNull(destKey, "Destination key must not be null");
Assert.notNull(sets, "Source sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights %d must match the number of source sets %d".formatted(weights.size(), sets.length));
byte[][] allKeys = ByteUtils.mergeArrays(destKey, sets);
@@ -1008,8 +1009,9 @@ public Set zUnionWithScores(Aggregate aggregate, Weights weights, byte[].
Assert.notNull(sets, "Sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ () -> "The number of weights %d must match the number of source sets %d".formatted(weights.size(),
+ sets.length));
if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) {
@@ -1052,8 +1054,8 @@ public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, by
Assert.notNull(destKey, "Destination key must not be null");
Assert.notNull(sets, "Source sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights %d must match the number of source sets %d".formatted(weights.size(), sets.length));
byte[][] allKeys = ByteUtils.mergeArrays(destKey, sets);
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
index 840f49dd04..3ec675dfdd 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
index 4e83c271cf..f810b52c37 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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.
@@ -1003,7 +1003,7 @@ private Jedis getActiveSentinel() {
return jedis;
}
} catch (Exception ex) {
- log.warn(String.format("Ping failed for sentinel host: %s", node.getHost()), ex);
+ log.warn("Ping failed for sentinel host: %s".formatted(node.getHost()), ex);
} finally {
if (!success && jedis != null) {
jedis.close();
@@ -1040,8 +1040,8 @@ private int getConnectTimeout() {
private MutableJedisClientConfiguration getMutableConfiguration() {
Assert.state(clientConfiguration instanceof MutableJedisClientConfiguration,
- () -> String.format("Client configuration must be instance of MutableJedisClientConfiguration but is %s",
- ClassUtils.getShortName(clientConfiguration.getClass())));
+ () -> "Client configuration must be instance of MutableJedisClientConfiguration but is %s"
+ .formatted(ClassUtils.getShortName(clientConfiguration.getClass())));
return (MutableJedisClientConfiguration) clientConfiguration;
}
@@ -1056,10 +1056,10 @@ private void assertInitialized() {
switch (current) {
case CREATED, STOPPED -> throw new IllegalStateException(
- String.format("JedisConnectionFactory has been %s. Use start() to initialize it", current));
+ "JedisConnectionFactory has been %s. Use start() to initialize it".formatted(current));
case DESTROYED ->
throw new IllegalStateException("JedisConnectionFactory was destroyed and cannot be used anymore");
- default -> throw new IllegalStateException(String.format("JedisConnectionFactory is %s", current));
+ default -> throw new IllegalStateException("JedisConnectionFactory is %s".formatted(current));
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
index 7a4c15613c..6be56d07b0 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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.
@@ -472,7 +472,7 @@ private static byte[] boundaryToBytes(org.springframework.data.domain.Range.Boun
} else if (theValue instanceof String string) {
value = toBytes(string);
} else {
- throw new IllegalArgumentException(String.format("Cannot convert %s to binary format", boundary.getValue()));
+ throw new IllegalArgumentException("Cannot convert %s to binary format".formatted(boundary.getValue()));
}
ByteBuffer buffer = ByteBuffer.allocate(prefix.length + value.length);
@@ -760,9 +760,8 @@ private static GeoSearchParam getGeoSearchParam(GeoShape predicate, GeoSearchPar
return param;
}
- if (predicate instanceof BoxShape) {
+ if (predicate instanceof BoxShape boxPredicate) {
- BoxShape boxPredicate = (BoxShape) predicate;
BoundingBox boundingBox = boxPredicate.getBoundingBox();
param.byBox(boundingBox.getWidth().getValue(), boundingBox.getHeight().getValue(),
@@ -771,7 +770,7 @@ private static GeoSearchParam getGeoSearchParam(GeoShape predicate, GeoSearchPar
return param;
}
- throw new IllegalArgumentException(String.format("Cannot convert %s to Jedis GeoSearchParam", predicate));
+ throw new IllegalArgumentException("Cannot convert %s to Jedis GeoSearchParam".formatted(predicate));
}
private static void configureGeoReference(GeoReference reference, GeoSearchParam param) {
@@ -782,14 +781,13 @@ private static void configureGeoReference(GeoReference reference, GeoSea
return;
}
- if (reference instanceof GeoReference.GeoCoordinateReference) {
+ if (reference instanceof GeoReference.GeoCoordinateReference> coordinates) {
- GeoReference.GeoCoordinateReference> coordinates = (GeoReference.GeoCoordinateReference>) reference;
param.fromLonLat(coordinates.getLongitude(), coordinates.getLatitude());
return;
}
- throw new IllegalArgumentException(String.format("Cannot extract Geo Reference from %s", reference));
+ throw new IllegalArgumentException("Cannot extract Geo Reference from %s".formatted(reference));
}
/**
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
index 743565b76a..50d594afa7 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/jedis/JedisGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
index a5f806974d..e034cefb0b 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisHashCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
index be2cf8bb90..a0ac8debf2 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
index 64e7dc92e1..25393cf2af 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisInvoker.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java
index 8d7a1cf2d3..586a35eca2 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.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/redis/connection/jedis/JedisKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
index 58fc4e2408..93f0ddfff6 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisListCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
index fc3e54259a..a7bb1dd619 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisMessageListener.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
index e44685e32b..2092efeaf1 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/jedis/JedisResult.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
index ca68b02d43..16b1483103 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisScriptReturnConverter.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
index d7a2223a18..0398623c5e 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2024 the original author or authors.
+ * Copyright 2013-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/redis/connection/jedis/JedisScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
index 13eb3178b4..3eb17cf5d6 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisSentinelConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java
index 8af29b6792..15dcb28db0 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.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/redis/connection/jedis/JedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
index bab0522591..a7e0feca2b 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -161,7 +161,7 @@ public void killClient(String host, int port) {
Assert.hasText(host, "Host for 'CLIENT KILL' must not be 'null' or 'empty'");
- connection.invokeStatus().just(it -> it.clientKill(String.format("%s:%s", host, port)));
+ connection.invokeStatus().just(it -> it.clientKill("%s:%s".formatted(host, port)));
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
index c9ed8280de..c2521b82db 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java
index c3ecbe8255..483b299c9c 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.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/redis/connection/jedis/JedisStringCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
index 889e87b102..9b21e8e715 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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/redis/connection/jedis/JedisSubscription.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
index 46a9b49668..6d34e4628d 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2024 the original author or authors.
+ * Copyright 2011-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/redis/connection/jedis/JedisZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
index 749e198bcb..e3cef50537 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 the original author or authors.
+ * Copyright 2017-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.
@@ -474,8 +474,8 @@ public Set zInterWithScores(Aggregate aggregate, Weights weights, byte[].
Assert.notNull(sets, "Sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights (%d) must match the number of source sets (%d)".formatted(weights.size(), sets.length));
return connection.invoke().fromMany(Jedis::zinterWithScores, PipelineBinaryCommands::zinterWithScores,
toZParams(aggregate, weights), sets).toSet(JedisConverters::toTuple);
@@ -487,8 +487,8 @@ public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, by
Assert.notNull(destKey, "Destination key must not be null");
Assert.notNull(sets, "Source sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights %d must match the number of source sets %d".formatted(weights.size(), sets.length));
ZParams zparams = toZParams(aggregate, weights);
@@ -528,8 +528,8 @@ public Set zUnionWithScores(Aggregate aggregate, Weights weights, byte[].
Assert.notNull(sets, "Sets must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights %d must match the number of source sets %d".formatted(weights.size(), sets.length));
return connection.invoke().fromMany(Jedis::zunionWithScores, PipelineBinaryCommands::zunionWithScores,
toZParams(aggregate, weights), sets).toSet(JedisConverters::toTuple);
@@ -542,8 +542,8 @@ public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, by
Assert.notNull(sets, "Source sets must not be null");
Assert.notNull(weights, "Weights must not be null");
Assert.noNullElements(sets, "Source sets must not contain null elements");
- Assert.isTrue(weights.size() == sets.length, () -> String
- .format("The number of weights (%d) must match the number of source sets (%d)", weights.size(), sets.length));
+ Assert.isTrue(weights.size() == sets.length,
+ "The number of weights %d must match the number of source sets %d".formatted(weights.size(), sets.length));
ZParams zparams = toZParams(aggregate, weights);
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java
index 60d16a1f4a..a68eef451a 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.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.
@@ -96,9 +96,8 @@ static List