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.data spring-data-redis - 3.3.0 + 3.3.13-SNAPSHOT Spring Data Redis Spring Data module for Redis @@ -14,15 +14,15 @@ org.springframework.data.build spring-data-parent - 3.3.0 + 3.3.13-SNAPSHOT - 3.3.0 - 3.3.0 + 3.3.13-SNAPSHOT + 3.3.13-SNAPSHOT 4.0.2 1.9.4 - 1.4.20 + 1.4.21 2.11.1 6.3.2.RELEASE 5.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.antora antora-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 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 mapToList(Map map) { if (v instanceof StreamEntryID) { sources.add(v.toString()); - } else if (v instanceof StreamEntry) { + } else if (v instanceof StreamEntry streamEntry) { List entries = new ArrayList<>(2); - StreamEntry streamEntry = (StreamEntry) v; entries.add(streamEntry.getID().toString()); entries.add(streamEntry.getFields()); sources.add(entries); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java index 0b2061f5a7..60564519fa 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.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. @@ -120,9 +120,8 @@ private Optional getReadFrom() { }); } - String message = String.format("Connection type %s not supported", connectionType); - - return LettuceFutureUtils.failed(new InvalidDataAccessApiUsageException(message)); + return LettuceFutureUtils + .failed(new InvalidDataAccessApiUsageException("Connection type %s not supported".formatted(connectionType))); } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java index c166000bca..f6b2028298 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.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. @@ -49,7 +49,7 @@ class DefaultLettuceClientConfiguration implements LettuceClientConfiguration { DefaultLettuceClientConfiguration(boolean useSsl, boolean verifyPeer, boolean startTls, @Nullable ClientResources clientResources, @Nullable ClientOptions clientOptions, @Nullable String clientName, @Nullable ReadFrom readFrom, @Nullable RedisCredentialsProviderFactory redisCredentialsProviderFactory, - Duration timeout, Duration shutdownTimeout, @Nullable Duration shutdownQuietPeriod) { + Duration timeout, Duration shutdownTimeout, Duration shutdownQuietPeriod) { this.useSsl = useSsl; this.verifyPeer = verifyPeer; @@ -61,7 +61,7 @@ class DefaultLettuceClientConfiguration implements LettuceClientConfiguration { this.redisCredentialsProviderFactory = Optional.ofNullable(redisCredentialsProviderFactory); this.timeout = timeout; this.shutdownTimeout = shutdownTimeout; - this.shutdownQuietPeriod = shutdownQuietPeriod != null ? shutdownQuietPeriod : shutdownTimeout; + this.shutdownQuietPeriod = shutdownQuietPeriod; } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java index fac5f8ec20..0ac1d8633b 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.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/lettuce/LettuceByteBufferPubSubListenerWrapper.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java index d76cc2aee1..c4bdc997a2 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.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/lettuce/LettuceClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java index 6372226843..416c4ba31a 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.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. @@ -175,7 +175,7 @@ class LettuceClientConfigurationBuilder { @Nullable RedisCredentialsProviderFactory redisCredentialsProviderFactory; Duration timeout = Duration.ofSeconds(RedisURI.DEFAULT_TIMEOUT); Duration shutdownTimeout = Duration.ofMillis(100); - @Nullable Duration shutdownQuietPeriod; + Duration shutdownQuietPeriod = Duration.ZERO; LettuceClientConfigurationBuilder() {} diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java index 3756e9f8b4..41a7cb94e1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.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. @@ -216,10 +216,8 @@ private RedisClusterClient getClient() { return (RedisClusterClient) redisClientProvider.getRedisClient(); } - String message = String.format("Connection provider %s does not implement RedisClientProvider", - connectionProvider.getClass().getName()); - - throw new IllegalStateException(message); + throw new IllegalStateException("Connection provider %s does not implement RedisClientProvider" + .formatted(connectionProvider.getClass().getName())); } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java index d220ed3cb4..96196ca6a6 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.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/lettuce/LettuceClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java index 29f36d29e7..aa5db78bac 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.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/lettuce/LettuceClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java index d8215c338f..f0fe06ccdb 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.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/lettuce/LettuceClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java index ae3d3b2e49..09eabc950e 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.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/lettuce/LettuceClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java index f7905764e5..9c27d41b64 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.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/lettuce/LettuceClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java index 6d2e66cda0..d17f801899 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.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/lettuce/LettuceClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java index 3a346141c2..2ff5bb3a84 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.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/lettuce/LettuceClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java index 4b6ae60f04..986569e55d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.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/lettuce/LettuceClusterTopologyProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java index 5176bf68e1..fb789b056c 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.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/lettuce/LettuceClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java index fa80eeda87..a99532618e 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.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/lettuce/LettuceConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java index c3ecbde730..4adc50ee60 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.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. @@ -328,7 +328,7 @@ public Object execute(String command, byte[]... args) { @SuppressWarnings({ "rawtypes", "unchecked" }) public Object execute(String command, @Nullable CommandOutput commandOutputTypeHint, byte[]... args) { - Assert.hasText(command, () -> String.format("A valid command [%s] needs to be specified", command)); + Assert.hasText(command, () -> "A valid command [%s] needs to be specified".formatted(command)); ProtocolKeyword commandType = getCommandType(command.trim().toUpperCase()); @@ -512,7 +512,7 @@ private void reset() { if (this.asyncDedicatedConnection != null) { try { if (customizedDatabaseIndex()) { - potentiallySelectDatabase(this.defaultDbIndex); + potentiallySelectDatabase(this.asyncDedicatedConnection, this.defaultDbIndex); } this.connectionProvider.release(this.asyncDedicatedConnection); this.asyncDedicatedConnection = null; @@ -937,9 +937,7 @@ RedisClusterCommands getDedicatedConnection() { return statefulClusterConnection.sync(); } - String message = String.format("%s is not a supported connection type", connection.getClass().getName()); - - throw new IllegalStateException(message); + throw new IllegalStateException("%s is not a supported connection type".formatted(connection.getClass().getName())); } protected RedisClusterAsyncCommands getAsyncDedicatedConnection() { @@ -953,25 +951,17 @@ protected RedisClusterAsyncCommands getAsyncDedicatedConnection( if (connection instanceof StatefulRedisConnection statefulConnection) { return statefulConnection.async(); } + if (asyncDedicatedConnection instanceof StatefulRedisClusterConnection statefulClusterConnection) { return statefulClusterConnection.async(); } - String message = String.format("%s is not a supported connection type", connection.getClass().getName()); - - throw new IllegalStateException(message); + throw new IllegalStateException("%s is not a supported connection type".formatted(connection.getClass().getName())); } @SuppressWarnings("unchecked") protected StatefulConnection doGetAsyncDedicatedConnection() { - - StatefulConnection connection = getConnectionProvider().getConnection(StatefulConnection.class); - - if (customizedDatabaseIndex()) { - potentiallySelectDatabase(this.dbIndex); - } - - return connection; + return getConnectionProvider().getConnection(StatefulConnection.class); } @Override @@ -1065,9 +1055,9 @@ private boolean customizedDatabaseIndex() { return defaultDbIndex != dbIndex; } - private void potentiallySelectDatabase(int dbIndex) { + private static void potentiallySelectDatabase(StatefulConnection connection, int dbIndex) { - if (asyncDedicatedConnection instanceof StatefulRedisConnection statefulConnection) { + if (connection instanceof StatefulRedisConnection statefulConnection) { statefulConnection.sync().select(dbIndex); } } @@ -1091,8 +1081,7 @@ private void validateCommand(ProtocolKeyword command, @Nullable byte[]... args) try { redisCommand.validateArgumentCount(args != null ? args.length : 0); } catch (IllegalArgumentException ex) { - String message = String.format("Validation failed for %s command", command); - throw new InvalidDataAccessApiUsageException(message, ex); + throw new InvalidDataAccessApiUsageException("Validation failed for %s command".formatted(command), ex); } } } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java index c406faaa1e..8e240bd5d8 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.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. @@ -63,7 +63,6 @@ import org.springframework.data.redis.connection.RedisConfiguration.ClusterConfiguration; import org.springframework.data.redis.connection.RedisConfiguration.WithDatabaseIndex; import org.springframework.data.redis.connection.RedisConfiguration.WithPassword; -import org.springframework.data.redis.util.RedisAssertions; import org.springframework.data.util.Optionals; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -666,8 +665,11 @@ public AbstractRedisClient getNativeClient() { */ public AbstractRedisClient getRequiredNativeClient() { - return RedisAssertions.requireState(getNativeClient(), - "Client not yet initialized; Did you forget to call initialize the bean"); + AbstractRedisClient client = getNativeClient(); + + Assert.state(client != null, "Client not yet initialized; Did you forget to call initialize the bean"); + + return client; } @Nullable @@ -1440,10 +1442,10 @@ private void assertStarted() { switch (current) { case CREATED, STOPPED -> throw new IllegalStateException( - String.format("LettuceConnectionFactory has been %s. Use start() to initialize it", current)); + "LettuceConnectionFactory has been %s. Use start() to initialize it".formatted(current)); case DESTROYED -> throw new IllegalStateException("LettuceConnectionFactory was destroyed and cannot be used anymore"); - default -> throw new IllegalStateException(String.format("LettuceConnectionFactory is %s", current)); + default -> throw new IllegalStateException("LettuceConnectionFactory is %s".formatted(current)); } } @@ -1496,8 +1498,8 @@ private RedisURI.Builder applyAuthentication(RedisURI.Builder builder) { private MutableLettuceClientConfiguration getMutableConfiguration() { Assert.state(clientConfiguration instanceof MutableLettuceClientConfiguration, - () -> String.format("Client configuration must be instance of MutableLettuceClientConfiguration but is %s", - ClassUtils.getShortName(clientConfiguration.getClass()))); + () -> "Client configuration must be instance of MutableLettuceClientConfiguration but is %s" + .formatted(ClassUtils.getShortName(clientConfiguration.getClass()))); return (MutableLettuceClientConfiguration) clientConfiguration; } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java index cdfcf5c980..ad352da67d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.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/lettuce/LettuceConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java index 354217c548..5548d2d1f6 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.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. @@ -863,16 +863,15 @@ static GeoSearch.GeoPredicate toGeoPredicate(GeoShape predicate) { return GeoSearch.byRadius(radius.getValue(), toGeoArgsUnit(radius.getMetric())); } - if (predicate instanceof BoxShape) { + if (predicate instanceof BoxShape boxPredicate) { - BoxShape boxPredicate = (BoxShape) predicate; BoundingBox boundingBox = boxPredicate.getBoundingBox(); return GeoSearch.byBox(boundingBox.getWidth().getValue(), boundingBox.getHeight().getValue(), toGeoArgsUnit(boxPredicate.getMetric())); } - throw new IllegalArgumentException(String.format("Cannot convert %s to Lettuce GeoPredicate", predicate)); + throw new IllegalArgumentException("Cannot convert %s to Lettuce GeoPredicate".formatted(predicate)); } static GeoSearch.GeoRef toGeoRef(GeoReference reference) { @@ -881,14 +880,12 @@ static GeoSearch.GeoRef toGeoRef(GeoReference reference) { return GeoSearch.fromMember(((GeoMemberReference) reference).getMember()); } - if (reference instanceof GeoReference.GeoCoordinateReference) { - - GeoCoordinateReference coordinates = (GeoCoordinateReference) reference; + if (reference instanceof GeoCoordinateReference coordinates) { return GeoSearch.fromCoordinates(coordinates.getLongitude(), coordinates.getLatitude()); } - throw new IllegalArgumentException(String.format("Cannot convert %s to Lettuce GeoRef", reference)); + throw new IllegalArgumentException("Cannot convert %s to Lettuce GeoRef".formatted(reference)); } static FlushMode toFlushMode(@Nullable RedisServerCommands.FlushOption option) { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java index 1b0a27441c..773f0a7522 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.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/lettuce/LettuceFutureUtils.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java index f1f56e1b5c..556d37b8f7 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.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. @@ -87,8 +87,8 @@ static T join(CompletionStage future) throws RuntimeException, Completion /** * Returns a {@link Function} that ignores {@link CompletionStage#exceptionally(Function) exceptional completion} by - * recovering to {@code null}. This allows to progress with a previously failed {@link CompletionStage} without regard - * to the actual success/exception state. + * recovering to {@literal null}. This allows to progress with a previously failed {@link CompletionStage} without + * regard to the actual success/exception state. * * @return */ diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java index f0ff6e2715..0cad933193 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.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/lettuce/LettuceHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java index 5125a82fb6..e4b53f4fb4 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.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/lettuce/LettuceHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java index 12fbbd5be2..d62e3b9d5e 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.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/lettuce/LettuceInvoker.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java index 7661db4a73..451593fc19 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.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/lettuce/LettuceKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java index 415da2ccaa..a9514cd793 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.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/lettuce/LettuceListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java index cc1be60431..4f930633f2 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.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/lettuce/LettuceMessageListener.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java index 2c4b021bbd..1451a2829d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.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/lettuce/LettucePoolingClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java index c9fa6c242e..bb72d32ccc 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.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/lettuce/LettucePoolingConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java index d82e88c3a0..88ef7561ab 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.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. @@ -135,9 +135,8 @@ public AbstractRedisClient getRedisClient() { return ((RedisClientProvider) connectionProvider).getRedisClient(); } - throw new IllegalStateException( - String.format("Underlying connection provider %s does not implement RedisClientProvider", - connectionProvider.getClass().getName())); + throw new IllegalStateException("Underlying connection provider %s does not implement RedisClientProvider" + .formatted(connectionProvider.getClass().getName())); } @Override @@ -165,9 +164,8 @@ public void release(StatefulConnection connection) { private void discardIfNecessary(StatefulConnection connection) { - if (connection instanceof StatefulRedisConnection) { + if (connection instanceof StatefulRedisConnection redisConnection) { - StatefulRedisConnection redisConnection = (StatefulRedisConnection) connection; if (redisConnection.isMulti()) { redisConnection.async().discard(); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java index c797927296..d682898458 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.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/lettuce/LettuceReactiveClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java index 9b5969d88d..70e5f200bc 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.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/lettuce/LettuceReactiveClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java index 999207aa75..788b00e0c1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.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/lettuce/LettuceReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java index 87c34658f8..ed7dd87242 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.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/lettuce/LettuceReactiveClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java index 2001abdf17..0d1f56c7b5 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.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/lettuce/LettuceReactiveClusterNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java index d25f6c1c95..d7dde2e6ed 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.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/lettuce/LettuceReactiveClusterScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java index e4907f90ce..8f084c5783 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.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/lettuce/LettuceReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java index fca3ee62de..e0f12524e2 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.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/lettuce/LettuceReactiveClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java index be5790956f..85d6feb3c1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.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/lettuce/LettuceReactiveClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java index 9de831682a..1de72bfbc1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.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/lettuce/LettuceReactiveClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java index b0d4e6a1b8..5c466dc9ab 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.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/lettuce/LettuceReactiveClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java index ccd8de9354..a4f1ad2288 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.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/lettuce/LettuceReactiveGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java index 4502f5eb07..9425570f4a 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.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/lettuce/LettuceReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java index 0837489840..b704321ef5 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.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/lettuce/LettuceReactiveHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java index f4cd6e9186..f7db48edd9 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.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/lettuce/LettuceReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java index a7df677064..a1371b7856 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.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/lettuce/LettuceReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java index 2721877f4c..77e6280491 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.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. @@ -74,7 +74,7 @@ public Flux> push(Publisher comm if (!command.getUpsert() && command.getValues().size() > 1) { throw new InvalidDataAccessApiUsageException( - String.format("%s PUSHX only allows one value", command.getDirection())); + "%s PUSHX only allows one value".formatted(command.getDirection())); } Mono pushResult; diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java index fd4b0de4f6..f05cff7134 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.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/lettuce/LettuceReactivePubSubCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java index 7e25074679..63fd654e10 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.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. @@ -233,7 +233,7 @@ static boolean deallocate(ByteBuffer buffer, Map targe @Override public String toString() { - return String.format("%s: Subscribers: %s", new String(raw), SUBSCRIBERS.get(this)); + return "%s: Subscribers: %s".formatted(new String(raw), SUBSCRIBERS.get(this)); } } } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java index a688e94060..b66d0827a0 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.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/lettuce/LettuceReactiveRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java index b99c098096..6905356065 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.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/lettuce/LettuceReactiveScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java index c6d5686486..ec89c3f831 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.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/lettuce/LettuceReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java index f3aa9bd2af..9b8f22f54a 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.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. @@ -154,7 +154,7 @@ public Mono killClient(String host, int port) { Assert.notNull(host, "Host must not be null or empty"); - return connection.execute(c -> c.clientKill(String.format("%s:%s", host, port))).next(); + return connection.execute(c -> c.clientKill("%s:%d".formatted(host, port))).next(); } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java index 8fd0d4f403..d74953a6b7 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.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/lettuce/LettuceReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java index e22b298146..1f45c373cd 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.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/lettuce/LettuceReactiveStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java index 5008c5e68d..eaec33cb20 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.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. @@ -364,7 +364,7 @@ public Flux> bitOp(Publisher c Assert.isTrue(sourceKeys.length == 1, "BITOP NOT does not allow more than 1 source key."); yield reactiveCommands.bitopNot(destinationKey, sourceKeys[0]); } - default -> throw new IllegalArgumentException(String.format("Unknown BITOP '%s'", command.getBitOp())); + default -> throw new IllegalArgumentException("Unknown BITOP '%s'".formatted(command.getBitOp())); }; return result.map(value -> new NumericResponse<>(command, value)); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java index 9098c14c84..9df426a53d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.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/lettuce/LettuceReactiveZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java index d11f6229be..415d76bfe2 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.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/lettuce/LettuceResult.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java index 4c0a825c85..d3e2f779a1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.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/lettuce/LettuceScanCursor.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java index 6f5ed1a945..b3b467533c 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.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. @@ -59,8 +59,8 @@ protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { } } - throw new IllegalArgumentException(String.format("Current scan %s state and cursor %d do not match", - state != null ? state.getCursor() : "(none)", cursorId)); + throw new IllegalArgumentException("Current scan %s state and cursor %d do not match" + .formatted(state != null ? state.getCursor() : "(none)", cursorId)); } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java index de38a44747..52ec10e0ed 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.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/lettuce/LettuceSentinelConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java index 79bf304a91..1abd08e60e 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.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/lettuce/LettuceServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java index 54a1dcfd6d..1b9124e138 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.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. @@ -26,7 +26,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.RedisNode; import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.core.types.RedisClientInfo; @@ -173,7 +172,7 @@ public void killClient(String host, int port) { Assert.hasText(host, "Host for 'CLIENT KILL' must not be 'null' or 'empty'"); - String client = String.format("%s:%s", host, port); + String client = "%s:%d".formatted(host, port); connection.invoke().just(RedisServerAsyncCommands::clientKill, client); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java index 3e210bdedd..cb165702ff 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.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/lettuce/LettuceStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java index 7f15f68e8e..ad5c2281c2 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.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/lettuce/LettuceStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java index 1397fc9ce7..ebaeb7475f 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.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/lettuce/LettuceSubscription.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java index 72acfef38f..32b0d97397 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.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/lettuce/LettuceZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java index 9ebccac7b9..aeb16f6e56 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.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. @@ -441,8 +441,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)); ZAggregateArgs zAggregateArgs = zAggregateArgs(aggregate, weights); @@ -456,8 +456,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)); ZStoreArgs storeArgs = zStoreArgs(aggregate, weights); @@ -496,8 +496,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)); ZAggregateArgs zAggregateArgs = zAggregateArgs(aggregate, weights); @@ -511,8 +511,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)); ZStoreArgs storeArgs = zStoreArgs(aggregate, weights); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java index 7777c165d9..9210d2d908 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.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/lettuce/RedisClientProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java index 637999d1d9..02c8ec152a 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.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/lettuce/RedisCredentialsProviderFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java index e34b8f5757..b29341b22b 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.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/lettuce/StandaloneConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java index 15bcd3d1bb..e812b4946b 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.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/lettuce/StaticMasterReplicaConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java index ca3d4337b0..562c2eef31 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.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. @@ -79,7 +79,7 @@ class StaticMasterReplicaConnectionProvider implements LettuceConnectionProvider return connectionType.cast(connection); } - throw new UnsupportedOperationException(String.format("Connection type %s not supported", connectionType)); + throw new UnsupportedOperationException("Connection type %s not supported".formatted(connectionType)); } @Override @@ -97,6 +97,6 @@ class StaticMasterReplicaConnectionProvider implements LettuceConnectionProvider }); } - throw new UnsupportedOperationException(String.format("Connection type %s not supported", connectionType)); + throw new UnsupportedOperationException("Connection type %s not supported".formatted(connectionType)); } } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java index a243a44748..ae17a9ca70 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.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/lettuce/aot/LettuceRuntimeHints.java b/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java index fc9d3ab70a..337b000195 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.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/lettuce/observability/DefaultLettuceObservationConvention.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java index fa662181f5..0286e91e15 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.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/lettuce/observability/LettuceObservationContext.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java index e1a77d3e7b..3cebef73bb 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.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/lettuce/observability/LettuceObservationConvention.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java index 92c1e0ee0a..345e1fc952 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.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/lettuce/observability/MicrometerTracingAdapter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java index 010c5eb155..372b88b954 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.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. @@ -214,7 +214,7 @@ public Span start(RedisCommand command) { this.command = command; if (log.isDebugEnabled()) { - log.debug(String.format("Starting Observation for Command %s", command)); + log.debug("Starting Observation for Command %s".formatted(command)); } if (command instanceof CompleteableCommand completeableCommand) { @@ -262,7 +262,7 @@ public Span tag(String key, String value) { public Span error(Throwable throwable) { if (log.isDebugEnabled()) { - log.debug(String.format("Attaching error to Observation for Command %s", command)); + log.debug("Attaching error to Observation for Command %s".formatted(command)); } observation.error(throwable); @@ -280,7 +280,7 @@ public Span remoteEndpoint(Endpoint endpoint) { public void finish() { if (log.isDebugEnabled()) { - log.debug(String.format("Stopping Observation for Command %s", command)); + log.debug("Stopping Observation for Command %s".formatted(command)); } observation.stop(); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java index fb57b0fd82..ce4b07d557 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.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/lettuce/observability/SocketAddressEndpoint.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java index ecc6b26fe1..386db947af 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.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/stream/ByteBufferRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java index 990dc0ffc6..488ad046fc 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.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/stream/ByteRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java index f2d97ca812..25d625ae6d 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.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/stream/Consumer.java b/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java index 6219266652..b5c05e1e03 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/Consumer.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. @@ -53,7 +53,7 @@ public static Consumer from(String group, String name) { @Override public String toString() { - return String.format("%s:%s", group, name); + return "%s:%s".formatted(group, name); } public String getGroup() { diff --git a/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java index 731af14240..baf61286b6 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.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/stream/ObjectRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java index 62c42775a6..7cb685dfb9 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.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/stream/PendingMessage.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java index 7358645534..7dfb35d506 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.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/stream/PendingMessages.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java index 80a3e146db..50130ecc64 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.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/stream/PendingMessagesSummary.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java index 5716b2f34f..1addb65e8c 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.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/stream/ReadOffset.java b/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java index 7efec2110c..0e9563d5ce 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.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/stream/Record.java b/src/main/java/org/springframework/data/redis/connection/stream/Record.java index 4c34d5ce87..9ad9a8cd6f 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/Record.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/Record.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/stream/RecordId.java b/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java index 5791a116d4..6e79c38cc7 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/RecordId.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/stream/StreamInfo.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java index c822fcea47..4a657a03f5 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.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/stream/StreamOffset.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java index 5ceb927972..df44bc663a 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.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/stream/StreamReadOptions.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java index 45c456c0bc..4729e38a41 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.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. @@ -96,7 +96,7 @@ public StreamReadOptions block(Duration timeout) { */ public StreamReadOptions count(long count) { - Assert.isTrue(count > 0, "Count must be greater or equal to zero"); + Assert.isTrue(count > 0, "Count must be greater than zero"); return new StreamReadOptions(block, count, noack); } diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java index bf9a34eec3..499119a1be 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.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. @@ -216,7 +216,7 @@ public ByteBufferRecord ofBuffer(Map value) { } else if (stream instanceof byte[]) { streamKey = ByteBuffer.wrap((byte[]) stream); } else { - throw new IllegalArgumentException(String.format("Stream key %s cannot be converted to byte buffer", stream)); + throw new IllegalArgumentException("Stream key %s cannot be converted to byte buffer".formatted(stream)); } return new ByteBufferMapBackedRecord(streamKey, id, value); diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java index 6558727a0b..6770bb3b77 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.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/stream/StringRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java index b1b8bce931..4d6c5a5bd3 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.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/util/AbstractSubscription.java b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java index d04adc7854..8ffb356306 100644 --- a/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java +++ b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.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/util/ByteArraySet.java b/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java index fe964dd947..2bf6e29b55 100644 --- a/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java +++ b/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.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/util/ByteArrayWrapper.java b/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java index 5a33c06642..883bc003c8 100644 --- a/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java +++ b/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.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/util/DecodeUtils.java b/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java index 3da38d5cad..9e688183d2 100644 --- a/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java +++ b/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.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/zset/Aggregate.java b/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java index 083e386575..49a735eb6d 100644 --- a/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java +++ b/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.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/zset/DefaultTuple.java b/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java index bddd817e0a..fb16b9f66a 100644 --- a/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java +++ b/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.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. @@ -58,9 +58,8 @@ public boolean equals(@Nullable Object obj) { return true; if (obj == null) return false; - if (!(obj instanceof DefaultTuple)) + if (!(obj instanceof DefaultTuple other)) return false; - DefaultTuple other = (DefaultTuple) obj; if (score == null) { if (other.score != null) return false; diff --git a/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java b/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java index a706af4a09..f1aca1f897 100644 --- a/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java +++ b/src/main/java/org/springframework/data/redis/connection/zset/Tuple.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/zset/Weights.java b/src/main/java/org/springframework/data/redis/connection/zset/Weights.java index a40045f274..754c48f230 100644 --- a/src/main/java/org/springframework/data/redis/connection/zset/Weights.java +++ b/src/main/java/org/springframework/data/redis/connection/zset/Weights.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. @@ -151,11 +151,10 @@ public boolean equals(@Nullable Object o) { return true; } - if (!(o instanceof Weights)) { + if (!(o instanceof Weights that)) { return false; } - Weights that = (Weights) o; return ObjectUtils.nullSafeEquals(this.weights, that.weights); } diff --git a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java index d3f2a080d4..991f5cc06a 100644 --- a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java +++ b/src/main/java/org/springframework/data/redis/core/AbstractOperations.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/core/BoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java index 4250560c0a..d11a387f80 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.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/core/BoundHashOperations.java b/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java index b7c30dc1b7..f906462911 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundHashOperations.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. @@ -61,7 +61,7 @@ public interface BoundHashOperations extends BoundKeyOperations { /** * Get values for given {@code keys} from the hash at the bound 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 keys must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. diff --git a/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java b/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java index d719b05fb2..e9d1f5e57c 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.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/core/BoundListOperations.java b/src/main/java/org/springframework/data/redis/core/BoundListOperations.java index 9c429debac..7efd3e8c99 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundListOperations.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. @@ -213,7 +213,7 @@ public interface BoundListOperations extends BoundKeyOperations { Long remove(long count, Object value); /** - * Get element at {@code index} form list at the bound key. + * Get element at {@code index} from list at the bound key. * * @param index * @return {@literal null} when used in pipeline / transaction. @@ -231,6 +231,7 @@ public interface BoundListOperations extends BoundKeyOperations { * @since 2.4 * @see Redis Documentation: LPOS */ + @Nullable Long indexOf(V value); /** @@ -242,6 +243,7 @@ public interface BoundListOperations extends BoundKeyOperations { * @since 2.4 * @see Redis Documentation: LPOS */ + @Nullable Long lastIndexOf(V value); /** diff --git a/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java b/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java index a65b1e200c..3492553b28 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java +++ b/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.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. @@ -70,7 +70,7 @@ public T createProxy(Class boundOperationsInterface, Object key, DataType proxyFactory.addAdvice( new BoundOperationsMethodInterceptor(key, operations, boundOperationsInterface, operationsTarget, delegate)); - return (T) proxyFactory.getProxy(); + return (T) proxyFactory.getProxy(getClass().getClassLoader()); } Method lookupRequiredMethod(Method method, Class targetClass, boolean considerKeyArgument) { @@ -144,9 +144,9 @@ public Object invoke(MethodInvocation invocation) throws Throwable { yield null; } case "getOperations" -> delegate.getOps(); - default -> method.getDeclaringClass() == boundOperationsInterface - ? doInvoke(invocation, method, operationsTarget, true) - : doInvoke(invocation, method, delegate, false); + default -> + method.getDeclaringClass() == boundOperationsInterface ? doInvoke(invocation, method, operationsTarget, true) + : doInvoke(invocation, method, delegate, false); }; } diff --git a/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java b/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java index b9d03ab655..424b210b67 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundSetOperations.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. @@ -185,6 +185,7 @@ public interface BoundSetOperations extends BoundKeyOperations { * @deprecated since 3.0, use {@link #difference(Object)} instead to follow a consistent method naming scheme. */ @Nullable + @Deprecated(since = "3.0") default Set diff(K key) { return difference(key); } @@ -209,6 +210,7 @@ default Set diff(K key) { * @deprecated since 3.0, use {@link #difference(Collection)} instead to follow a consistent method naming scheme. */ @Nullable + @Deprecated(since = "3.0") default Set diff(Collection keys) { return difference(keys); } diff --git a/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java b/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java index b589c99163..ebac262049 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.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/core/BoundValueOperations.java b/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java index b11d7c6657..40be5358f8 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundValueOperations.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/core/BoundZSetOperations.java b/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java index 724cb5cd11..160d0836ad 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.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/core/BulkMapper.java b/src/main/java/org/springframework/data/redis/core/BulkMapper.java index 686b285f66..77fa487672 100644 --- a/src/main/java/org/springframework/data/redis/core/BulkMapper.java +++ b/src/main/java/org/springframework/data/redis/core/BulkMapper.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/core/CloseSuppressingInvocationHandler.java b/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java index cdd8c26f1f..1f85f9d389 100644 --- a/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java +++ b/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.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/core/ClusterOperations.java b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java index 833ca61620..f96c8c0d39 100644 --- a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ClusterOperations.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/core/ClusterOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java index 1f5fe55704..a662e7e437 100644 --- a/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.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/core/ConvertingCursor.java b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java index e80ea71d1a..b0d5e1e5fd 100644 --- a/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java +++ b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.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/core/Cursor.java b/src/main/java/org/springframework/data/redis/core/Cursor.java index fa60b0e489..e52cfc5d77 100644 --- a/src/main/java/org/springframework/data/redis/core/Cursor.java +++ b/src/main/java/org/springframework/data/redis/core/Cursor.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/core/DefaultClusterOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java index 77a285ae0f..7215430082 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.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/core/DefaultGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java index e451cf97d7..9456bff358 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.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/core/DefaultHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java index 1bfb9c3467..974e20e13f 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.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/core/DefaultHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java index 41d8dc0406..30f0c4c3e9 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.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/core/DefaultListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java index 61855b8b0d..ce0268869c 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.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/core/DefaultReactiveGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java index 12192babd2..6e92f6a749 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.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/core/DefaultReactiveHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java index fec1f2e7e1..c3e004c25d 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.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/core/DefaultReactiveHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java index d9c3516741..c3acc12718 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.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/core/DefaultReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java index 74297cd674..1a26f750a7 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.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/core/DefaultReactiveSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java index 13b546689e..4294bca879 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.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/core/DefaultReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java index 432cf77283..94755e00b6 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.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/core/DefaultReactiveValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java index 0f0ac35200..4ed0483330 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.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/core/DefaultReactiveZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java index 40869055e1..65ae76a139 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.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,6 +27,7 @@ import java.util.function.Function; import org.reactivestreams.Publisher; + import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Range; import org.springframework.data.redis.connection.Limit; @@ -38,7 +39,6 @@ import org.springframework.data.redis.core.ZSetOperations.TypedTuple; import org.springframework.data.redis.serializer.RedisSerializationContext; import org.springframework.data.redis.util.ByteUtils; -import org.springframework.data.redis.util.RedisAssertions; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -745,8 +745,13 @@ private V readValue(ByteBuffer buffer) { private V readRequiredValue(ByteBuffer buffer) { - return RedisAssertions.requireNonNull(readValue(buffer), - () -> new InvalidDataAccessApiUsageException("Deserialized sorted set value is null")); + V value = readValue(buffer); + + if (value == null) { + throw new InvalidDataAccessApiUsageException("Deserialized sorted set value is null"); + } + + return value; } private TypedTuple readTypedTuple(Tuple raw) { diff --git a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java index 5949af8d73..9c8b87dad3 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.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/core/DefaultStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java index 52eaa318ae..271786f2a9 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.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/core/DefaultTypedTuple.java b/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java index c26cdbe912..3ae83af6c5 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.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/core/DefaultValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java index 9938d5a0ec..c947ccafc0 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.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/core/DefaultZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java index 059f746707..030974bf8c 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.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/core/GeoOperations.java b/src/main/java/org/springframework/data/redis/core/GeoOperations.java index f06f2a88fc..6b20c07789 100644 --- a/src/main/java/org/springframework/data/redis/core/GeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/GeoOperations.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/core/GeoOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java index c55b5f55ab..5de01d1f56 100644 --- a/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.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/core/HashMapperProvider.java b/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java index 2b1b77547d..ae0df547b7 100644 --- a/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java +++ b/src/main/java/org/springframework/data/redis/core/HashMapperProvider.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/core/HashOperations.java b/src/main/java/org/springframework/data/redis/core/HashOperations.java index 8e98e49f97..8a2c6641ad 100644 --- a/src/main/java/org/springframework/data/redis/core/HashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/HashOperations.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. @@ -61,7 +61,7 @@ public interface HashOperations { /** * Get values for given {@code hashKeys} 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}. + * Absent field values are represented using {@literal null} in the resulting {@link List}. * * @param key must not be {@literal null}. * @param hashKeys must not be {@literal null}. diff --git a/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java index 30d31d81f2..8f8a1a751f 100644 --- a/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.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/core/HyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java index 0c16fa1be4..9adb6252f4 100644 --- a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java +++ b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.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/core/HyperLogLogOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java index abf47663bc..4087bf24d4 100644 --- a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.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/core/IndexWriter.java b/src/main/java/org/springframework/data/redis/core/IndexWriter.java index a7f1cf5f60..73e2a27347 100644 --- a/src/main/java/org/springframework/data/redis/core/IndexWriter.java +++ b/src/main/java/org/springframework/data/redis/core/IndexWriter.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. @@ -33,23 +33,26 @@ /** * {@link IndexWriter} takes care of writing secondary index structures to - * Redis. Depending on the type of {@link IndexedData} it uses eg. Sets with specific names to add actually referenced - * keys to. While doing so {@link IndexWriter} also keeps track of all indexes associated with the root types key, which + * Redis. Depending on the type of {@link IndexedData}, it uses Sets with specific names to add actually referenced keys + * to. While doing so {@link IndexWriter} also keeps track of all indexes associated with the root types key, which * allows to remove the root key from all indexes in case of deletion. * * @author Christoph Strobl * @author Rob Winch + * @author Mark Paluch * @since 1.7 */ class IndexWriter { + private static final byte[] SEPARATOR = ":".getBytes(); + private static final byte[] IDX = "idx".getBytes(); + private final RedisConnection connection; private final RedisConverter converter; /** * Creates new {@link IndexWriter}. * - * @param keyspace The key space to write index values to. Must not be {@literal null}. * @param connection must not be {@literal null}. * @param converter must not be {@literal null}. */ @@ -127,7 +130,7 @@ public void removeKeyFromIndexes(String keyspace, Object key) { Assert.notNull(key, "Key must not be null"); byte[] binKey = toBytes(key); - byte[] indexHelperKey = ByteUtils.concatAll(toBytes(keyspace + ":"), binKey, toBytes(":idx")); + byte[] indexHelperKey = createIndexKey(keyspace, binKey); for (byte[] indexKey : connection.sMembers(indexHelperKey)) { @@ -147,10 +150,10 @@ public void removeKeyFromIndexes(String keyspace, Object key) { */ public void removeAllIndexes(String keyspace) { - Set potentialIndex = connection.keys(toBytes(keyspace + ":*")); + Set potentialIndex = connection.keys(createIndexKey(keyspace, "*")); if (!potentialIndex.isEmpty()) { - connection.del(potentialIndex.toArray(new byte[potentialIndex.size()][])); + connection.del(potentialIndex.toArray(new byte[0][])); } } @@ -162,7 +165,7 @@ private void removeKeyFromExistingIndexes(byte[] key, Iterable inde } /** - * Remove given key from all indexes matching {@link IndexedData#getIndexName()}: + * Remove given key from all indexes matching {@link IndexedData#getIndexName()}. * * @param key * @param indexedData @@ -171,8 +174,7 @@ protected void removeKeyFromExistingIndexes(byte[] key, IndexedData indexedData) Assert.notNull(indexedData, "IndexedData must not be null"); - Set existingKeys = connection - .keys(toBytes(indexedData.getKeyspace() + ":" + indexedData.getIndexName() + ":*")); + Set existingKeys = connection.keys(createIndexKey(indexedData.getKeyPrefix(), "*")); if (!CollectionUtils.isEmpty(existingKeys)) { for (byte[] existingKey : existingKeys) { @@ -216,12 +218,12 @@ protected void addKeyToIndex(byte[] key, IndexedData indexedData) { return; } - byte[] indexKey = toBytes(indexedData.getKeyspace() + ":" + indexedData.getIndexName() + ":"); + byte[] indexKey = toBytes(indexedData.getKeyPrefix(), SEPARATOR); indexKey = ByteUtils.concat(indexKey, toBytes(value)); connection.sAdd(indexKey, key); // keep track of indexes used for the object - connection.sAdd(ByteUtils.concatAll(toBytes(indexedData.getKeyspace() + ":"), key, toBytes(":idx")), indexKey); + connection.sAdd(createIndexKey(indexedData.getKeyspace(), key), indexKey); } else if (indexedData instanceof GeoIndexedPropertyValue propertyValue) { Object value = propertyValue.getValue(); @@ -229,15 +231,51 @@ protected void addKeyToIndex(byte[] key, IndexedData indexedData) { return; } - byte[] indexKey = toBytes(indexedData.getKeyspace() + ":" + indexedData.getIndexName()); + byte[] indexKey = toBytes(indexedData.getKeyPrefix()); connection.geoAdd(indexKey, propertyValue.getPoint(), key); // keep track of indexes used for the object - connection.sAdd(ByteUtils.concatAll(toBytes(indexedData.getKeyspace() + ":"), key, toBytes(":idx")), indexKey); + connection.sAdd(createIndexKey(indexedData.getKeyspace(), key), indexKey); } else { throw new IllegalArgumentException( - String.format("Cannot write index data for unknown index type %s", indexedData.getClass())); + "Cannot write index data for unknown index type %s".formatted(indexedData.getClass())); + } + } + + private byte[] createIndexKey(String keyspace, byte[] key) { + return createIndexKey(keyspace, key, IDX); + } + + private byte[] createIndexKey(Object... items) { + + Object[] elements = new Object[items.length + (items.length - 1)]; + + int j = 0; + for (int i = 0; i < items.length; i++) { + + elements[j++] = items[i]; + if (items.length - 1 > i) { + elements[j++] = SEPARATOR; + } } + + return toBytes(elements); + } + + private byte[] toBytes(Object... values) { + + byte[][] arrays = new byte[values.length][]; + + for (int i = 0; i < values.length; i++) { + + if (values[i] instanceof byte[] bb) { + arrays[i] = bb; + } else { + arrays[i] = toBytes(values[i]); + } + } + + return ByteUtils.concatAll(arrays); } private byte[] toBytes(@Nullable Object source) { @@ -254,10 +292,9 @@ private byte[] toBytes(@Nullable Object source) { return converter.getConversionService().convert(source, byte[].class); } - throw new InvalidDataAccessApiUsageException(String.format( - "Cannot convert %s to binary representation for index key generation; " - + "Are you missing a Converter; Did you register a non PathBasedRedisIndexDefinition that might apply to a complex type", - source.getClass())); + throw new InvalidDataAccessApiUsageException(("Cannot convert %s to binary representation for index key generation;" + + " Are you missing a Converter; Did you register a non PathBasedRedisIndexDefinition" + + " that might apply to a complex type").formatted(source.getClass())); } /** diff --git a/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java b/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java index 2cc66d5d79..a0c553509a 100644 --- a/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java +++ b/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.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/core/KeyScanOptions.java b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java index 0cbb843732..888157c525 100644 --- a/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java +++ b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.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/core/ListOperations.java b/src/main/java/org/springframework/data/redis/core/ListOperations.java index f5c8948385..960de066ba 100644 --- a/src/main/java/org/springframework/data/redis/core/ListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ListOperations.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. @@ -368,7 +368,7 @@ default V move(K sourceKey, Direction from, K destinationKey, Direction to, Dura Long remove(K key, long count, Object value); /** - * Get element at {@code index} form list at {@code key}. + * Get element at {@code index} from list at {@code key}. * * @param key must not be {@literal null}. * @param index diff --git a/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java index cf8fc18daa..4c7834d885 100644 --- a/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.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/core/PartialUpdate.java b/src/main/java/org/springframework/data/redis/core/PartialUpdate.java index f516b1f65f..400333efdc 100644 --- a/src/main/java/org/springframework/data/redis/core/PartialUpdate.java +++ b/src/main/java/org/springframework/data/redis/core/PartialUpdate.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/core/ReactiveGeoOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java index 76471777ae..b159d532f6 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.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/core/ReactiveHashOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java index 0f2950654a..2151590ecc 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.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. @@ -28,8 +28,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl @@ -66,7 +66,7 @@ public interface ReactiveHashOperations { /** * Get values for given {@code hashKeys} 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}. + * Absent field values are represented using {@literal null} in the resulting {@link List}. * * @param key must not be {@literal null}. * @param hashKeys must not be {@literal null}. diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java index e0ed1f6148..671a99b493 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.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/core/ReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java index 6a701c2eac..9911a8ad8a 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.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. @@ -33,8 +33,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl @@ -277,7 +277,7 @@ default Mono move(MoveFrom from, MoveTo to, Duration timeout) { Mono remove(K key, long count, Object value); /** - * Get element at {@code index} form list at {@code key}. + * Get element at {@code index} from list at {@code key}. * * @param key must not be {@literal null}. * @param index diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java index 3a22e9a771..fe5be55d0a 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.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/core/ReactiveRedisOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java index c02d1eea81..7f2b259967 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.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. @@ -45,8 +45,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java index 3511b7ed02..8db54083fe 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.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/core/ReactiveRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java index 7816a744a8..92792ed81b 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.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. @@ -58,8 +58,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java index eb9e55e431..c3cbad9445 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.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,8 +27,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java index fc3ca29651..bbd14c1704 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.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/core/ReactiveStringRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java index a5a915e6e7..a593214d7f 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.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/core/ReactiveValueOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java index 2a0f44404c..123376c1d2 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.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. @@ -30,8 +30,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Jiahe Cai @@ -54,7 +54,7 @@ public interface ReactiveValueOperations { * @param key must not be {@literal null}. * @param value * @param timeout must not be {@literal null}. - * @see Redis Documentation: SETEX + * @see Redis Documentation: SET */ Mono set(K key, V value, Duration timeout); @@ -63,7 +63,7 @@ public interface ReactiveValueOperations { * * @param key must not be {@literal null}. * @param value - * @see Redis Documentation: SETNX + * @see Redis Documentation: SET */ Mono setIfAbsent(K key, V value); @@ -162,7 +162,7 @@ public interface ReactiveValueOperations { /** * 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}. * @see Redis Documentation: MGET @@ -281,6 +281,7 @@ public interface ReactiveValueOperations { * @param command must not be {@literal null}. * @return * @since 2.1 + * @see Redis Documentation: BITFIELD */ Mono> bitField(K key, BitFieldSubCommands command); @@ -288,6 +289,7 @@ public interface ReactiveValueOperations { * Removes the given {@literal key}. * * @param key must not be {@literal null}. + * @see Redis Documentation: DEL */ Mono delete(K key); } diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java index 552f008c24..eb7e882ed8 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.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. @@ -37,8 +37,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl diff --git a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java b/src/main/java/org/springframework/data/redis/core/RedisAccessor.java index 09c8decc24..5753347654 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java +++ b/src/main/java/org/springframework/data/redis/core/RedisAccessor.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/core/RedisCallback.java b/src/main/java/org/springframework/data/redis/core/RedisCallback.java index 0c40d0702b..9ad8b41306 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisCallback.java +++ b/src/main/java/org/springframework/data/redis/core/RedisCallback.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. @@ -32,13 +32,13 @@ public interface RedisCallback { /** * Method called by {@link RedisTemplate} with an active {@link RedisConnection}. *

- * Callback code need not care about activating/opening or closing the {@link RedisConnection}, - * nor handling {@link Exception exceptions}. + * Callback code need not care about activating/opening or closing the {@link RedisConnection}, nor handling + * {@link Exception exceptions}. * * @param connection active {@link RedisConnection Redis connection}. - * @return the {@link Object result} of the operation performed in the callback or {@code null}. + * @return the {@link Object result} of the operation performed in the callback or {@literal null}. * @throws DataAccessException if the operation performed by the callback fails to execute in the context of Redis - * using the given {@link RedisConnection}. + * using the given {@link RedisConnection}. */ @Nullable T doInRedis(RedisConnection connection) throws DataAccessException; diff --git a/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java b/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java index b9ac36c83d..f13ea55dd9 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java +++ b/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.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/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java index 5621a216d9..e9303233df 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java +++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.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. @@ -377,16 +377,17 @@ public void validateArgumentCount(int argumentCount) { if (requiresArguments()) { if (requiresExactNumberOfArguments()) { if (argumentCount != this.maxArgs) { - throw newIllegalArgumentException("%s command requires %d %s", name(), this.maxArgs, arguments(this.maxArgs)); + throw new IllegalArgumentException( + "%s command requires %d %s".formatted(name(), this.maxArgs, arguments(this.maxArgs))); } } if (argumentCount < this.minArgs) { - throw newIllegalArgumentException("%s command requires at least %d %s", name(), this.minArgs, - arguments(this.maxArgs)); + throw new IllegalArgumentException( + "%s command requires at least %d %s".formatted(name(), this.minArgs, arguments(this.maxArgs))); } if (this.maxArgs > 0 && argumentCount > this.maxArgs) { - throw newIllegalArgumentException("%s command requires at most %s %s", name(), this.maxArgs, - arguments(this.maxArgs)); + throw new IllegalArgumentException( + "%s command requires at most %s %s".formatted(name(), this.maxArgs, arguments(this.maxArgs))); } } } @@ -394,9 +395,4 @@ public void validateArgumentCount(int argumentCount) { private String arguments(int count) { return count == 1 ? "argument" : "arguments"; } - - private IllegalArgumentException newIllegalArgumentException(String message, Object... arguments) { - return new IllegalArgumentException(String.format(message, arguments)); - } - } diff --git a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java index 20e4954ae0..8ae2902193 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java +++ b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.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. @@ -495,14 +495,14 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab if (isPotentiallyThreadBoundCommand(commandToExecute)) { if (log.isDebugEnabled()) { - log.debug(String.format("Invoke '%s' on bound connection", method.getName())); + log.debug("Invoke '%s' on bound connection".formatted(method.getName())); } return invoke(method, obj, args); } if (log.isDebugEnabled()) { - log.debug(String.format("Invoke '%s' on unbound connection", method.getName())); + log.debug("Invoke '%s' on unbound connection".formatted(method.getName())); } RedisConnection connection = factory.getConnection(); @@ -587,7 +587,7 @@ public RedisConnection getRequiredConnection() { * Override the existing {@link RedisConnection} handle with the given {@link RedisConnection}. Reset the handle if * given {@literal null}. *

- * Used for releasing the Connection on suspend (with a {@code null} argument) and setting a fresh Connection on + * Used for releasing the Connection on suspend (with a {@literal null} argument) and setting a fresh Connection on * resume. */ protected void setConnection(@Nullable RedisConnection connection) { diff --git a/src/main/java/org/springframework/data/redis/core/RedisHash.java b/src/main/java/org/springframework/data/redis/core/RedisHash.java index b0cb2a1ea1..4ffcb57d2e 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisHash.java +++ b/src/main/java/org/springframework/data/redis/core/RedisHash.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/core/RedisKeyExpiredEvent.java b/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java index a57f5fee93..3ebed4eb48 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java +++ b/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.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/core/RedisKeyValueAdapter.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java index 6aaabbe156..ae7f48ec2c 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java +++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.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/core/RedisKeyValueTemplate.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java index edbe5c2ff6..4e1454f533 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.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/core/RedisKeyspaceEvent.java b/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java index 3a5b6b342f..aff2138cb0 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java +++ b/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.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/core/RedisOperations.java b/src/main/java/org/springframework/data/redis/core/RedisOperations.java index 7128522447..8c1ad67ad6 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/RedisOperations.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. @@ -47,6 +47,7 @@ * @author Todd Merrill * @author Chen Li * @author Vedran Pavic + * @author Marcin Grzejszczak */ public interface RedisOperations { @@ -61,7 +62,7 @@ public interface RedisOperations { * * @param return type * @param action callback object that specifies the Redis action. Must not be {@literal null}. - * @return a result object returned by the action or {@literal null} + * @return result of the given {@link RedisCallback#doInRedis(RedisConnection)} invocation. */ @Nullable T execute(RedisCallback action); @@ -72,7 +73,7 @@ public interface RedisOperations { * * @param return type * @param session session callback. Must not be {@literal null}. - * @return result object returned by the action or {@literal null} + * @return result of the given {@link SessionCallback#execute(RedisOperations)} invocation. */ @Nullable T execute(SessionCallback session); @@ -83,7 +84,9 @@ public interface RedisOperations { * serializers to deserialize results * * @param action callback object to execute - * @return list of objects returned by the pipeline + * @return pipeline results of the given {@link RedisCallback#doInRedis(RedisConnection)} invocation. Results are + * collected from {@link RedisConnection} calls, {@link RedisCallback#doInRedis(RedisConnection)} itself must + * return {@literal null}. */ List executePipelined(RedisCallback action); @@ -94,7 +97,9 @@ public interface RedisOperations { * @param action callback object to execute * @param resultSerializer The Serializer to use for individual values or Collections of values. If any returned * values are hashes, this serializer will be used to deserialize both the key and value - * @return list of objects returned by the pipeline + * @return pipeline results of the given {@link RedisCallback#doInRedis(RedisConnection)} invocation. Results are + * collected from {@link RedisConnection} calls, {@link RedisCallback#doInRedis(RedisConnection)} itself must + * return {@literal null}. */ List executePipelined(RedisCallback action, RedisSerializer resultSerializer); @@ -103,7 +108,9 @@ public interface RedisOperations { * callback cannot return a non-null value as it gets overwritten by the pipeline. * * @param session Session callback - * @return list of objects returned by the pipeline + * @return pipeline results of the given {@link SessionCallback#execute(RedisOperations)} invocation. Results are + * collected from {@link RedisOperations} calls, {@link SessionCallback#execute(RedisOperations)} itself must + * return {@literal null}. */ List executePipelined(SessionCallback session); @@ -114,7 +121,9 @@ public interface RedisOperations { * * @param session Session callback * @param resultSerializer - * @return list of objects returned by the pipeline + * @return pipeline results of the given {@link SessionCallback#execute(RedisOperations)} invocation. Results are + * collected from {@link RedisOperations} calls, {@link SessionCallback#execute(RedisOperations)} itself must + * return {@literal null}. */ List executePipelined(SessionCallback session, RedisSerializer resultSerializer); @@ -151,7 +160,7 @@ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSer * to free resources after use. * * @param callback must not be {@literal null}. - * @return + * @return the {@link Object result} of the operation performed in the callback or {@literal null}. * @since 1.8 */ @Nullable @@ -167,7 +176,7 @@ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSer * @param sourceKey must not be {@literal null}. * @param targetKey must not be {@literal null}. * @param replace whether the key was copied. {@literal null} when used in pipeline / transaction. - * @return + * @return {@code true} when copied successfully or {@literal null} when used in pipeline / transaction. * @see Redis Documentation: COPY * @since 2.6 */ @@ -178,7 +187,7 @@ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSer * Determine if given {@code key} exists. * * @param key must not be {@literal null}. - * @return + * @return {@literal true} if key exists. {@literal null} when used in pipeline / transaction. * @see Redis Documentation: EXISTS */ @Nullable @@ -361,7 +370,7 @@ default Boolean expireAt(K key, Instant expireAt) { * Remove the expiration from given {@code key}. * * @param key must not be {@literal null}. - * @return {@literal null} when used in pipeline / transaction. + * @return {@code true} when persisted successfully or {@literal null} when used in pipeline / transaction. * @see Redis Documentation: PERSIST */ @Nullable @@ -650,7 +659,7 @@ default void restore(K key, byte[] value, long timeToLive, TimeUnit unit) { BoundHashOperations boundHashOps(K key); /** - * @return + * @return never {@literal null}. * @since 1.5 */ HyperLogLogOperations opsForHyperLogLog(); diff --git a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java index 07b946d2b9..070e04d4ac 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java +++ b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.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,6 +25,7 @@ import java.util.Map; import java.util.Set; +import org.springframework.core.convert.ConversionService; import org.springframework.data.geo.Circle; import org.springframework.data.geo.GeoResult; import org.springframework.data.geo.GeoResults; @@ -81,8 +82,8 @@ private RedisQueryEngine(CriteriaAccessor criteriaAccessor, @Override @SuppressWarnings("unchecked") - public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, - String keyspace, Class type) { + public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, String keyspace, + Class type) { List result = doFind(criteria, offset, rows, keyspace, type); if (sort != null) { @@ -199,8 +200,7 @@ private List findKeys(RedisOperationChain criteria, int rows, String key } @Override - public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, - String keyspace) { + public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, String keyspace) { return execute(criteria, sort, offset, rows, keyspace, Object.class); } @@ -229,14 +229,13 @@ public long count(RedisOperationChain criteria, String keyspace) { private byte[][] keys(String prefix, Collection source) { + ConversionService conversionService = getRequiredAdapter().getConverter().getConversionService(); byte[][] keys = new byte[source.size()][]; int i = 0; for (PathAndValue pathAndValue : source) { - byte[] convertedValue = getRequiredAdapter().getConverter().getConversionService() - .convert(pathAndValue.getFirstValue(), byte[].class); - byte[] fullPath = getRequiredAdapter().getConverter().getConversionService() - .convert(prefix + pathAndValue.getPath() + ":", byte[].class); + byte[] convertedValue = conversionService.convert(pathAndValue.getFirstValue(), byte[].class); + byte[] fullPath = conversionService.convert(prefix + pathAndValue.getPath() + ":", byte[].class); keys[i] = ByteUtils.concat(fullPath, convertedValue); i++; diff --git a/src/main/java/org/springframework/data/redis/core/RedisTemplate.java b/src/main/java/org/springframework/data/redis/core/RedisTemplate.java index 93ee4ca0de..2879f161a4 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/RedisTemplate.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. @@ -66,10 +66,11 @@ * Redis store. By default, it uses Java serialization for its objects (through {@link JdkSerializationRedisSerializer} * ). For String intensive operations consider the dedicated {@link StringRedisTemplate}. *

- * The central method is execute, supporting Redis access code implementing the {@link RedisCallback} interface. It - * provides {@link RedisConnection} handling such that neither the {@link RedisCallback} implementation nor the calling - * code needs to explicitly care about retrieving/closing Redis connections, or handling Connection lifecycle - * exceptions. For typical single step actions, there are various convenience methods. + * The central method is {@link #execute(RedisCallback)}, supporting Redis access code implementing the + * {@link RedisCallback} interface. It provides {@link RedisConnection} handling such that neither the + * {@link RedisCallback} implementation nor the calling code needs to explicitly care about retrieving/closing Redis + * connections, or handling Connection lifecycle exceptions. For typical single step actions, there are various + * convenience methods. *

* Once configured, this class is thread-safe. *

@@ -116,11 +117,12 @@ public class RedisTemplate extends RedisAccessor implements RedisOperation ObjectHashMapper.getSharedInstance()); private final ZSetOperations zSetOps = new DefaultZSetOperations<>(this); private final GeoOperations geoOps = new DefaultGeoOperations<>(this); + private final HashOperations hashOps = new DefaultHashOperations<>(this); private final HyperLogLogOperations hllOps = new DefaultHyperLogLogOperations<>(this); private final ClusterOperations clusterOps = new DefaultClusterOperations<>(this); /** - * Constructs a new RedisTemplate instance. + * Constructs a new {@code RedisTemplate} instance. */ public RedisTemplate() {} @@ -159,46 +161,59 @@ public void afterPropertiesSet() { } /** - * Returns whether to expose the native Redis connection to RedisCallback code, or rather a connection proxy (the - * default). + * Returns whether the underlying RedisConnection should be directly exposed to the RedisCallback code, or rather a + * connection proxy (default behavior). * - * @return whether to expose the native Redis connection or not + * @return {@literal true} to expose the native Redis connection or {@literal false} to provide a proxied connection + * to RedisCallback code. */ public boolean isExposeConnection() { return exposeConnection; } /** - * Sets whether to expose the Redis connection to {@link RedisCallback} code. Default is "false": a proxy will be - * returned, suppressing {@code quit} and {@code disconnect} calls. + * Sets whether the underlying RedisConnection should be directly exposed to the RedisCallback code. By default, the + * connection is not exposed, and a proxy is used instead. This proxy suppresses potentially disruptive operations, + * such as {@code quit} and {@code disconnect} commands, ensuring that the connection remains stable during the + * callback execution. Defaults to proxy use. * - * @param exposeConnection + * @param exposeConnection {@literal true} to expose the actual Redis connection to RedisCallback code, allowing full + * access to Redis commands, including quit and disconnect. {@literal false} to proxy connections that + * suppress the quit and disconnect commands, protecting the connection from being inadvertently closed + * during callback execution. */ public void setExposeConnection(boolean exposeConnection) { this.exposeConnection = exposeConnection; } /** - * @return Whether or not the default serializer should be used. If not, any serializers not explicitly set will - * remain null and values will not be serialized or deserialized. + * Returns whether the default serializer should be used or not. + * + * @return {@literal true} if the default serializer should be used; {@literal false} otherwise. */ public boolean isEnableDefaultSerializer() { return enableDefaultSerializer; } /** - * @param enableDefaultSerializer Whether or not the default serializer should be used. If not, any serializers not - * explicitly set will remain null and values will not be serialized or deserialized. + * Configure whether the default serializer should be used or not. If the default serializer is enabled, the template + * will use it to serialize and deserialize values. However, if the default serializer is disabled , any serializers + * that have not been explicitly set will remain {@literal null}, and their corresponding values will neither be + * serialized nor deserialized. Defaults to {@literal true}. + * + * @param enableDefaultSerializer {@literal true} if the default serializer should be used; {@literal false} + * otherwise. */ public void setEnableDefaultSerializer(boolean enableDefaultSerializer) { this.enableDefaultSerializer = enableDefaultSerializer; } /** - * If set to {@code true} {@link RedisTemplate} will participate in ongoing transactions using - * {@literal MULTI...EXEC|DISCARD} to keep track of operations. + * Sets whether this template participates in ongoing transactions using {@literal MULTI...EXEC|DISCARD} to keep track + * of operations. * - * @param enableTransactionSupport whether to participate in ongoing transactions. + * @param enableTransactionSupport {@literal true}to participate in ongoing transactions; {@literal false} to not + * track transactions. * @since 1.3 * @see RedisConnectionUtils#getConnection(RedisConnectionFactory, boolean) * @see TransactionSynchronizationManager#isActualTransactionActive() @@ -208,7 +223,7 @@ public void setEnableTransactionSupport(boolean enableTransactionSupport) { } /** - * Set the {@link ClassLoader} to be used for the default {@link JdkSerializationRedisSerializer} in case no other + * Sets the {@link ClassLoader} to be used for the default {@link JdkSerializationRedisSerializer} in case no other * {@link RedisSerializer} is explicitly set as the default one. * * @param classLoader can be {@literal null}. @@ -223,7 +238,7 @@ public void setBeanClassLoader(ClassLoader classLoader) { /** * Returns the default serializer used by this template. * - * @return template default serializer + * @return template default serializer. */ @Nullable public RedisSerializer getDefaultSerializer() { @@ -235,7 +250,7 @@ public RedisSerializer getDefaultSerializer() { * {@link #setStringSerializer(RedisSerializer)}) are initialized to this value unless explicitly set. Defaults to * {@link JdkSerializationRedisSerializer}. * - * @param serializer default serializer to use + * @param serializer default serializer to use. */ public void setDefaultSerializer(RedisSerializer serializer) { this.defaultSerializer = serializer; @@ -966,18 +981,21 @@ public GeoOperations opsForGeo() { } @Override + @SuppressWarnings("unchecked") public BoundGeoOperations boundGeoOps(K key) { return boundOperations.createProxy(BoundGeoOperations.class, key, DataType.ZSET, this, RedisOperations::opsForGeo); } @Override + @SuppressWarnings("unchecked") public BoundHashOperations boundHashOps(K key) { return boundOperations.createProxy(BoundHashOperations.class, key, DataType.HASH, this, it -> it.opsForHash()); } @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) public HashOperations opsForHash() { - return new DefaultHashOperations<>(this); + return (HashOperations) hashOps; } @Override @@ -991,12 +1009,14 @@ public ListOperations opsForList() { } @Override + @SuppressWarnings("unchecked") public BoundListOperations boundListOps(K key) { return boundOperations.createProxy(BoundListOperations.class, key, DataType.LIST, this, RedisOperations::opsForList); } @Override + @SuppressWarnings("unchecked") public BoundSetOperations boundSetOps(K key) { return boundOperations.createProxy(BoundSetOperations.class, key, DataType.SET, this, RedisOperations::opsForSet); } @@ -1007,6 +1027,7 @@ public SetOperations opsForSet() { } @Override + @SuppressWarnings("unchecked") public StreamOperations opsForStream() { return (StreamOperations) streamOps; } @@ -1017,11 +1038,13 @@ public StreamOperations opsForStream(HashMapper BoundStreamOperations boundStreamOps(K key) { return boundOperations.createProxy(BoundStreamOperations.class, key, DataType.STREAM, this, it -> opsForStream()); } @Override + @SuppressWarnings("unchecked") public BoundValueOperations boundValueOps(K key) { return boundOperations.createProxy(BoundValueOperations.class, key, DataType.STRING, this, RedisOperations::opsForValue); @@ -1033,6 +1056,7 @@ public ValueOperations opsForValue() { } @Override + @SuppressWarnings("unchecked") public BoundZSetOperations boundZSetOps(K key) { return boundOperations.createProxy(BoundZSetOperations.class, key, DataType.ZSET, this, RedisOperations::opsForZSet); diff --git a/src/main/java/org/springframework/data/redis/core/ScanCursor.java b/src/main/java/org/springframework/data/redis/core/ScanCursor.java index 8c94ff726b..4f3cdf7882 100644 --- a/src/main/java/org/springframework/data/redis/core/ScanCursor.java +++ b/src/main/java/org/springframework/data/redis/core/ScanCursor.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. @@ -86,7 +86,7 @@ public ScanCursor(CursorId cursorId) { * Crates new {@link ScanCursor} * * @param cursorId the cursor Id. - * @param options Defaulted to {@link ScanOptions#NONE} if {@code null}. + * @param options Defaulted to {@link ScanOptions#NONE} if {@literal null}. * @deprecated since 3.3.0 - Use {@link ScanCursor#ScanCursor(CursorId, ScanOptions)} instead. */ @Deprecated(since = "3.3.0") @@ -125,7 +125,7 @@ private void scan(CursorId cursorId) { /** * Performs the actual scan command using the native client implementation. The given {@literal options} are never - * {@code null}. + * {@literal null}. * * @param cursorId * @param options diff --git a/src/main/java/org/springframework/data/redis/core/ScanIteration.java b/src/main/java/org/springframework/data/redis/core/ScanIteration.java index 1be8cf8771..3e0b5a5929 100644 --- a/src/main/java/org/springframework/data/redis/core/ScanIteration.java +++ b/src/main/java/org/springframework/data/redis/core/ScanIteration.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/core/ScanOptions.java b/src/main/java/org/springframework/data/redis/core/ScanOptions.java index 959aa9aaea..b7520703f6 100644 --- a/src/main/java/org/springframework/data/redis/core/ScanOptions.java +++ b/src/main/java/org/springframework/data/redis/core/ScanOptions.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/core/SessionCallback.java b/src/main/java/org/springframework/data/redis/core/SessionCallback.java index 0d41a5299f..42a53a068f 100644 --- a/src/main/java/org/springframework/data/redis/core/SessionCallback.java +++ b/src/main/java/org/springframework/data/redis/core/SessionCallback.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/core/SetOperations.java b/src/main/java/org/springframework/data/redis/core/SetOperations.java index 00471359d3..b1eddb91da 100644 --- a/src/main/java/org/springframework/data/redis/core/SetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/SetOperations.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/core/SetOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/SetOperationsEditor.java index cad663aff8..a00ce61de0 100644 --- a/src/main/java/org/springframework/data/redis/core/SetOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/SetOperationsEditor.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/core/StreamObjectMapper.java b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java index d8e340f330..4b72930993 100644 --- a/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java +++ b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.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/core/StreamOperations.java b/src/main/java/org/springframework/data/redis/core/StreamOperations.java index 4636c5bcf6..8bfb545558 100644 --- a/src/main/java/org/springframework/data/redis/core/StreamOperations.java +++ b/src/main/java/org/springframework/data/redis/core/StreamOperations.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/core/StreamOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.java index 5776342b2c..1dbb0b6bad 100644 --- a/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.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/core/StringRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/StringRedisTemplate.java index 072872be57..5661d4f714 100644 --- a/src/main/java/org/springframework/data/redis/core/StringRedisTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/StringRedisTemplate.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/core/TimeToLive.java b/src/main/java/org/springframework/data/redis/core/TimeToLive.java index bcc148c608..c3f568a947 100644 --- a/src/main/java/org/springframework/data/redis/core/TimeToLive.java +++ b/src/main/java/org/springframework/data/redis/core/TimeToLive.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/core/TimeToLiveAccessor.java b/src/main/java/org/springframework/data/redis/core/TimeToLiveAccessor.java index 0b90a8c973..54ecf92735 100644 --- a/src/main/java/org/springframework/data/redis/core/TimeToLiveAccessor.java +++ b/src/main/java/org/springframework/data/redis/core/TimeToLiveAccessor.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/core/TimeoutUtils.java b/src/main/java/org/springframework/data/redis/core/TimeoutUtils.java index 064fda4a8e..86d90ca882 100644 --- a/src/main/java/org/springframework/data/redis/core/TimeoutUtils.java +++ b/src/main/java/org/springframework/data/redis/core/TimeoutUtils.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/core/ValueOperations.java b/src/main/java/org/springframework/data/redis/core/ValueOperations.java index 546a83f8ff..e3abd0918f 100644 --- a/src/main/java/org/springframework/data/redis/core/ValueOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ValueOperations.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. @@ -62,7 +62,7 @@ public interface ValueOperations { * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. - * @see Redis Documentation: SETEX + * @see Redis Documentation: SET * @since 2.1 */ default void set(K key, V value, Duration timeout) { @@ -82,7 +82,7 @@ default void set(K key, V value, Duration timeout) { * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: SETNX + * @see Redis Documentation: SET */ @Nullable Boolean setIfAbsent(K key, V value); @@ -264,7 +264,7 @@ default Boolean setIfPresent(K key, V value, Duration timeout) { /** * 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 {@literal null} when used in pipeline / transaction. diff --git a/src/main/java/org/springframework/data/redis/core/ValueOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ValueOperationsEditor.java index 1eaf8949fa..dd87ce60f4 100644 --- a/src/main/java/org/springframework/data/redis/core/ValueOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/ValueOperationsEditor.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/core/ZSetOperations.java b/src/main/java/org/springframework/data/redis/core/ZSetOperations.java index e20f560410..263346fe5f 100644 --- a/src/main/java/org/springframework/data/redis/core/ZSetOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ZSetOperations.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/core/ZSetOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ZSetOperationsEditor.java index 124eccfd07..23526dc956 100644 --- a/src/main/java/org/springframework/data/redis/core/ZSetOperationsEditor.java +++ b/src/main/java/org/springframework/data/redis/core/ZSetOperationsEditor.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/core/convert/BinaryConverters.java b/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java index 402a68d7ac..0befb22a44 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java +++ b/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.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. @@ -289,7 +289,7 @@ public Date convert(byte[] source) { } catch (ParseException ignore) { } - throw new IllegalArgumentException(String.format("Cannot parse date out of %s", Arrays.toString(source))); + throw new IllegalArgumentException("Cannot parse date out of %s".formatted(Arrays.toString(source))); } } diff --git a/src/main/java/org/springframework/data/redis/core/convert/Bucket.java b/src/main/java/org/springframework/data/redis/core/convert/Bucket.java index 3599e8b5ee..e832acf8e7 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/Bucket.java +++ b/src/main/java/org/springframework/data/redis/core/convert/Bucket.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. @@ -108,10 +108,10 @@ public byte[] get(String path) { } /** - * Return whether {@code path} is associated with a non-{@code null} value. + * Return whether {@code path} is associated with a non-{@literal null} value. * * @param path must not be {@literal null} or {@link String#isEmpty()}. - * @return {@literal true} if the {@code path} is associated with a non-{@code null} value. + * @return {@literal true} if the {@code path} is associated with a non-{@literal null} value. * @since 2.5 */ public boolean hasValue(String path) { diff --git a/src/main/java/org/springframework/data/redis/core/convert/CompositeIndexResolver.java b/src/main/java/org/springframework/data/redis/core/convert/CompositeIndexResolver.java index fd6d702cd0..13581c45dc 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/CompositeIndexResolver.java +++ b/src/main/java/org/springframework/data/redis/core/convert/CompositeIndexResolver.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/core/convert/DefaultRedisTypeMapper.java b/src/main/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapper.java index 5896c6ff43..9b538ec135 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapper.java +++ b/src/main/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapper.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/core/convert/GeoIndexedPropertyValue.java b/src/main/java/org/springframework/data/redis/core/convert/GeoIndexedPropertyValue.java index 979d576a08..d45cd31a16 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/GeoIndexedPropertyValue.java +++ b/src/main/java/org/springframework/data/redis/core/convert/GeoIndexedPropertyValue.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. @@ -74,11 +74,10 @@ public boolean equals(@Nullable Object o) { return true; } - if (!(o instanceof GeoIndexedPropertyValue)) { + if (!(o instanceof GeoIndexedPropertyValue that)) { return false; } - GeoIndexedPropertyValue that = (GeoIndexedPropertyValue) o; if (!ObjectUtils.nullSafeEquals(keyspace, that.keyspace)) { return false; } diff --git a/src/main/java/org/springframework/data/redis/core/convert/IndexResolver.java b/src/main/java/org/springframework/data/redis/core/convert/IndexResolver.java index 95c63c2992..b06e82587a 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/IndexResolver.java +++ b/src/main/java/org/springframework/data/redis/core/convert/IndexResolver.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/core/convert/IndexedData.java b/src/main/java/org/springframework/data/redis/core/convert/IndexedData.java index e6c0fce9e5..298c48cf6b 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/IndexedData.java +++ b/src/main/java/org/springframework/data/redis/core/convert/IndexedData.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. @@ -38,4 +38,13 @@ public interface IndexedData { */ String getKeyspace(); + /** + * Return the key prefix for usage in Redis. + * + * @return concatenated form of the keyspace and the index name. + * @since 3.3.4 + */ + default String getKeyPrefix() { + return getKeyspace() + ":" + getIndexName(); + } } diff --git a/src/main/java/org/springframework/data/redis/core/convert/IndexedDataFactoryProvider.java b/src/main/java/org/springframework/data/redis/core/convert/IndexedDataFactoryProvider.java index c9521d0602..3c4a51bbf7 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/IndexedDataFactoryProvider.java +++ b/src/main/java/org/springframework/data/redis/core/convert/IndexedDataFactoryProvider.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/core/convert/Jsr310Converters.java b/src/main/java/org/springframework/data/redis/core/convert/Jsr310Converters.java index d4e874e9e9..225e1ef85b 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/Jsr310Converters.java +++ b/src/main/java/org/springframework/data/redis/core/convert/Jsr310Converters.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/core/convert/KeyspaceConfiguration.java b/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java index d3fcd1b5cb..5bb5b0a470 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.java +++ b/src/main/java/org/springframework/data/redis/core/convert/KeyspaceConfiguration.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/core/convert/MappingConfiguration.java b/src/main/java/org/springframework/data/redis/core/convert/MappingConfiguration.java index a938bbeafa..61d79cf68f 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/MappingConfiguration.java +++ b/src/main/java/org/springframework/data/redis/core/convert/MappingConfiguration.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/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java index e9e1a9f312..1cea9a221a 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java +++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.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. @@ -540,8 +540,8 @@ private void writePartialPropertyUpdate(PartialUpdate update, PropertyUpdate map.put(((Entry) pUpdate.getValue()).getKey(), ((Entry) pUpdate.getValue()).getValue()); } else { throw new MappingException( - String.format("Cannot set update value for map property '%s' to '%s'; Please use a Map or Map.Entry", - pUpdate.getPropertyPath(), pUpdate.getValue())); + ("Cannot set update value for map property '%s' to '%s';" + " Please use a Map or Map.Entry") + .formatted(pUpdate.getPropertyPath(), pUpdate.getValue())); } writeMap(entity.getKeySpace(), pUpdate.getPropertyPath(), targetProperty.getMapValueType(), map, sink); @@ -601,8 +601,7 @@ private void writeInternal(@Nullable String keyspace, String path, @Nullable Obj } else { if (!ClassUtils.isAssignable(typeHint.getType(), value.getClass())) { - throw new MappingException( - String.format(INVALID_TYPE_ASSIGNMENT, value.getClass(), path, typeHint.getType())); + throw new MappingException(INVALID_TYPE_ASSIGNMENT.formatted(value.getClass(), path, typeHint.getType())); } writeToBucket(path, value, sink, typeHint.getType()); } @@ -751,7 +750,7 @@ private void writeCollection(@Nullable String keyspace, String path, @Nullable I if (!ClassUtils.isAssignable(typeHint.getType(), value.getClass())) { throw new MappingException( - String.format(INVALID_TYPE_ASSIGNMENT, value.getClass(), currentPath, typeHint.getType())); + INVALID_TYPE_ASSIGNMENT.formatted(value.getClass(), currentPath, typeHint.getType())); } if (customConversions.hasCustomWriteTarget(value.getClass())) { @@ -794,7 +793,7 @@ private void writeToBucket(String path, @Nullable Object value, RedisData sink, sink.getBucket().put(path, toBytes(value)); } else { throw new IllegalArgumentException( - String.format("Cannot convert value '%s' of type %s to bytes", value, value.getClass())); + "Cannot convert value '%s' of type %s to bytes".formatted(value, value.getClass())); } } } @@ -855,7 +854,7 @@ private void writeMap(@Nullable String keyspace, String path, Class mapValueT if (!ClassUtils.isAssignable(mapValueType, entry.getValue().getClass())) { throw new MappingException( - String.format(INVALID_TYPE_ASSIGNMENT, entry.getValue().getClass(), currentPath, mapValueType)); + INVALID_TYPE_ASSIGNMENT.formatted(entry.getValue().getClass(), currentPath, mapValueType)); } if (customConversions.hasCustomWriteTarget(entry.getValue().getClass())) { @@ -945,8 +944,7 @@ private Object extractMapKeyForPath(String path, String key, Class targetType Matcher matcher = pattern.matcher(key); if (!matcher.find()) { - throw new IllegalArgumentException( - String.format("Cannot extract map value for key '%s' in path '%s'.", key, path)); + throw new IllegalArgumentException("Cannot extract map value for key '%s' in path '%s'".formatted(key, path)); } Object mapKey = matcher.group(2); @@ -1224,7 +1222,7 @@ private KeyspaceIdentifier(String keyspace, String id, boolean phantomKey) { */ public static KeyspaceIdentifier of(String key) { - Assert.isTrue(isValid(key), String.format("Invalid key %s", key)); + Assert.isTrue(isValid(key), () -> "Invalid key %s".formatted(key)); boolean phantomKey = key.endsWith(PHANTOM_SUFFIX); int keyspaceEndIndex = key.indexOf(DELIMITER); @@ -1304,7 +1302,7 @@ private BinaryKeyspaceIdentifier(byte[] keyspace, byte[] id, boolean phantomKey) */ public static BinaryKeyspaceIdentifier of(byte[] key) { - Assert.isTrue(isValid(key), String.format("Invalid key %s", new String(key))); + Assert.isTrue(isValid(key), () -> "Invalid key %s".formatted(new String(key))); boolean phantomKey = ByteUtils.startsWith(key, PHANTOM_SUFFIX, key.length - PHANTOM_SUFFIX.length); diff --git a/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java b/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java index f23873ee9d..00c1964217 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java +++ b/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.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/core/convert/RedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/RedisConverter.java index 998f223233..dbbb692472 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/RedisConverter.java +++ b/src/main/java/org/springframework/data/redis/core/convert/RedisConverter.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/core/convert/RedisCustomConversions.java b/src/main/java/org/springframework/data/redis/core/convert/RedisCustomConversions.java index 5f097242a9..a58f3c9b23 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/RedisCustomConversions.java +++ b/src/main/java/org/springframework/data/redis/core/convert/RedisCustomConversions.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/core/convert/RedisData.java b/src/main/java/org/springframework/data/redis/core/convert/RedisData.java index a571c205f9..1b68ebaefd 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/RedisData.java +++ b/src/main/java/org/springframework/data/redis/core/convert/RedisData.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/core/convert/RedisTypeMapper.java b/src/main/java/org/springframework/data/redis/core/convert/RedisTypeMapper.java index 8f8ba965ab..6babc758a4 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/RedisTypeMapper.java +++ b/src/main/java/org/springframework/data/redis/core/convert/RedisTypeMapper.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/core/convert/ReferenceResolver.java b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolver.java index a68653200c..0c2bc6b37f 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolver.java +++ b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolver.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/core/convert/ReferenceResolverImpl.java b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java index 19ad617332..32d5b7f496 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.java +++ b/src/main/java/org/springframework/data/redis/core/convert/ReferenceResolverImpl.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/core/convert/RemoveIndexedData.java b/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java index fde0d7d740..d8d5820c96 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java +++ b/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.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/core/convert/SimpleIndexedPropertyValue.java b/src/main/java/org/springframework/data/redis/core/convert/SimpleIndexedPropertyValue.java index f218e7d07a..27d8f21612 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/SimpleIndexedPropertyValue.java +++ b/src/main/java/org/springframework/data/redis/core/convert/SimpleIndexedPropertyValue.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/core/convert/SpelIndexResolver.java b/src/main/java/org/springframework/data/redis/core/convert/SpelIndexResolver.java index a386a29cdc..4b5f8418ae 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/SpelIndexResolver.java +++ b/src/main/java/org/springframework/data/redis/core/convert/SpelIndexResolver.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/core/index/ConfigurableIndexDefinitionProvider.java b/src/main/java/org/springframework/data/redis/core/index/ConfigurableIndexDefinitionProvider.java index d97a686caa..4c22120359 100644 --- a/src/main/java/org/springframework/data/redis/core/index/ConfigurableIndexDefinitionProvider.java +++ b/src/main/java/org/springframework/data/redis/core/index/ConfigurableIndexDefinitionProvider.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/core/index/GeoIndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/GeoIndexDefinition.java index 00a7edc640..9c2af6ca81 100644 --- a/src/main/java/org/springframework/data/redis/core/index/GeoIndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/GeoIndexDefinition.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. @@ -66,8 +66,8 @@ public Point convert(@Nullable Object source) { } throw new IllegalArgumentException( - String.format("Cannot convert %s to %s; GeoIndexed property needs to be of type Point or GeoLocation", - source.getClass(), Point.class)); + ("Cannot convert %s to %s; GeoIndexed property needs to be of type Point" + " or GeoLocation") + .formatted(source.getClass(), Point.class)); } } } diff --git a/src/main/java/org/springframework/data/redis/core/index/GeoIndexed.java b/src/main/java/org/springframework/data/redis/core/index/GeoIndexed.java index 185b7bd19d..dd6c353abf 100644 --- a/src/main/java/org/springframework/data/redis/core/index/GeoIndexed.java +++ b/src/main/java/org/springframework/data/redis/core/index/GeoIndexed.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/core/index/IndexConfiguration.java b/src/main/java/org/springframework/data/redis/core/index/IndexConfiguration.java index 12b55bbaf5..cb226bbaba 100644 --- a/src/main/java/org/springframework/data/redis/core/index/IndexConfiguration.java +++ b/src/main/java/org/springframework/data/redis/core/index/IndexConfiguration.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/core/index/IndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/IndexDefinition.java index 86151fc07e..deb6775be8 100644 --- a/src/main/java/org/springframework/data/redis/core/index/IndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/IndexDefinition.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/core/index/IndexDefinitionProvider.java b/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionProvider.java index e4d07547d4..df4ee0769d 100644 --- a/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionProvider.java +++ b/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionProvider.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/core/index/IndexDefinitionRegistry.java b/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionRegistry.java index 8e723ad498..90a395307b 100644 --- a/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionRegistry.java +++ b/src/main/java/org/springframework/data/redis/core/index/IndexDefinitionRegistry.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/core/index/IndexValueTransformer.java b/src/main/java/org/springframework/data/redis/core/index/IndexValueTransformer.java index 13d77f9ee7..127c3ed88a 100644 --- a/src/main/java/org/springframework/data/redis/core/index/IndexValueTransformer.java +++ b/src/main/java/org/springframework/data/redis/core/index/IndexValueTransformer.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/core/index/Indexed.java b/src/main/java/org/springframework/data/redis/core/index/Indexed.java index 15dc14d3c0..1099d28265 100644 --- a/src/main/java/org/springframework/data/redis/core/index/Indexed.java +++ b/src/main/java/org/springframework/data/redis/core/index/Indexed.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/core/index/PathBasedRedisIndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/PathBasedRedisIndexDefinition.java index 9526f279b3..3f8e90c883 100644 --- a/src/main/java/org/springframework/data/redis/core/index/PathBasedRedisIndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/PathBasedRedisIndexDefinition.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/core/index/RedisIndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/RedisIndexDefinition.java index 122659a12c..9831e3b9a0 100644 --- a/src/main/java/org/springframework/data/redis/core/index/RedisIndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/RedisIndexDefinition.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. @@ -105,10 +105,9 @@ public boolean equals(@Nullable Object obj) { if (obj == null) { return false; } - if (!(obj instanceof RedisIndexDefinition)) { + if (!(obj instanceof RedisIndexDefinition that)) { return false; } - RedisIndexDefinition that = (RedisIndexDefinition) obj; if (!ObjectUtils.nullSafeEquals(this.keyspace, that.keyspace)) { return false; diff --git a/src/main/java/org/springframework/data/redis/core/index/SimpleIndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/SimpleIndexDefinition.java index 5bd19d501d..75d7ba6163 100644 --- a/src/main/java/org/springframework/data/redis/core/index/SimpleIndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/SimpleIndexDefinition.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/core/index/SpelIndexDefinition.java b/src/main/java/org/springframework/data/redis/core/index/SpelIndexDefinition.java index 8501e3b1b9..c346945686 100644 --- a/src/main/java/org/springframework/data/redis/core/index/SpelIndexDefinition.java +++ b/src/main/java/org/springframework/data/redis/core/index/SpelIndexDefinition.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/core/mapping/BasicRedisPersistentEntity.java b/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java index 7c68335874..4874308b27 100644 --- a/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.java +++ b/src/main/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntity.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. @@ -89,16 +89,14 @@ protected RedisPersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNul boolean newIdPropertyIsExplicit = property.isAnnotationPresent(Id.class); if (currentIdPropertyIsExplicit && newIdPropertyIsExplicit) { - throw new MappingException(String.format( - "Attempt to add explicit id property %s but already have an property %s registered " - + "as explicit id; Check your mapping configuration", - property.getField(), currentIdProperty.getField())); + throw new MappingException(("Attempt to add explicit id property %s but already have a property %s" + + " registered as explicit id; Check your mapping configuration") + .formatted(property.getField(), currentIdProperty.getField())); } if (!currentIdPropertyIsExplicit && !newIdPropertyIsExplicit) { - throw new MappingException( - String.format("Attempt to add id property %s but already have an property %s registered " - + "as id; Check your mapping configuration", property.getField(), currentIdProperty.getField())); + throw new MappingException(("Attempt to add id property %s but already have a property %s registered as id;" + + " Check your mapping configuration").formatted(property.getField(), currentIdProperty.getField())); } if (newIdPropertyIsExplicit) { diff --git a/src/main/java/org/springframework/data/redis/core/mapping/RedisMappingContext.java b/src/main/java/org/springframework/data/redis/core/mapping/RedisMappingContext.java index e623311ee9..fa445cbfa5 100644 --- a/src/main/java/org/springframework/data/redis/core/mapping/RedisMappingContext.java +++ b/src/main/java/org/springframework/data/redis/core/mapping/RedisMappingContext.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. @@ -241,17 +241,15 @@ public Long getTimeToLive(Object source) { return TimeUnit.SECONDS.convert(timeout.longValue(), ttl.unit()); } } catch (IllegalAccessException ex) { - String message = String.format("Not allowed to access method '%s': %s", - timeoutMethod.getName(), ex.getMessage()); - throw new IllegalStateException(message, ex); + throw new IllegalStateException( + "Not allowed to access method '%s': %s".formatted(timeoutMethod.getName(), ex.getMessage()), ex); } catch (IllegalArgumentException ex) { - String message = String.format("Cannot invoke method '%s' without arguments: %s", - timeoutMethod.getName(), ex.getMessage()); - throw new IllegalStateException(message, ex); + throw new IllegalStateException( + "Cannot invoke method '%s' without arguments: %s".formatted(timeoutMethod.getName(), ex.getMessage()), + ex); } catch (InvocationTargetException ex) { - String message = String.format("Cannot access method '%s': %s", - timeoutMethod.getName(), ex.getMessage()); - throw new IllegalStateException(message, ex); + throw new IllegalStateException( + "Cannot access method '%s': %s".formatted(timeoutMethod.getName(), ex.getMessage()), ex); } } } diff --git a/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentEntity.java b/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentEntity.java index a31eca7895..57c8f6f47b 100644 --- a/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentEntity.java +++ b/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentEntity.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/core/mapping/RedisPersistentProperty.java b/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentProperty.java index e607b2aeb7..81a21681df 100644 --- a/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentProperty.java +++ b/src/main/java/org/springframework/data/redis/core/mapping/RedisPersistentProperty.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/core/query/DefaultSortCriterion.java b/src/main/java/org/springframework/data/redis/core/query/DefaultSortCriterion.java index af4c532900..5ffecf9c73 100644 --- a/src/main/java/org/springframework/data/redis/core/query/DefaultSortCriterion.java +++ b/src/main/java/org/springframework/data/redis/core/query/DefaultSortCriterion.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/core/query/DefaultSortQuery.java b/src/main/java/org/springframework/data/redis/core/query/DefaultSortQuery.java index 3746520ce9..62f07e69ee 100644 --- a/src/main/java/org/springframework/data/redis/core/query/DefaultSortQuery.java +++ b/src/main/java/org/springframework/data/redis/core/query/DefaultSortQuery.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/core/query/QueryUtils.java b/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java index dd11c5dfdd..9aa364f578 100644 --- a/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java +++ b/src/main/java/org/springframework/data/redis/core/query/QueryUtils.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/core/query/SortCriterion.java b/src/main/java/org/springframework/data/redis/core/query/SortCriterion.java index acb86537a1..10d3703149 100644 --- a/src/main/java/org/springframework/data/redis/core/query/SortCriterion.java +++ b/src/main/java/org/springframework/data/redis/core/query/SortCriterion.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/core/query/SortQuery.java b/src/main/java/org/springframework/data/redis/core/query/SortQuery.java index 491a9eea30..7cedfbc180 100644 --- a/src/main/java/org/springframework/data/redis/core/query/SortQuery.java +++ b/src/main/java/org/springframework/data/redis/core/query/SortQuery.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/core/query/SortQueryBuilder.java b/src/main/java/org/springframework/data/redis/core/query/SortQueryBuilder.java index 2065256b38..35b739b9b7 100644 --- a/src/main/java/org/springframework/data/redis/core/query/SortQueryBuilder.java +++ b/src/main/java/org/springframework/data/redis/core/query/SortQueryBuilder.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/core/script/DefaultReactiveScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java index 66c0bb4303..bf1f28a55d 100644 --- a/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.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/core/script/DefaultRedisScript.java b/src/main/java/org/springframework/data/redis/core/script/DefaultRedisScript.java index 1d7dac0286..f5e927d6ee 100644 --- a/src/main/java/org/springframework/data/redis/core/script/DefaultRedisScript.java +++ b/src/main/java/org/springframework/data/redis/core/script/DefaultRedisScript.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/core/script/DefaultScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/DefaultScriptExecutor.java index 9c96c1671c..d33af3c5f3 100644 --- a/src/main/java/org/springframework/data/redis/core/script/DefaultScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/DefaultScriptExecutor.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/core/script/DigestUtils.java b/src/main/java/org/springframework/data/redis/core/script/DigestUtils.java index d8b4635ca3..d0bb64a3ca 100644 --- a/src/main/java/org/springframework/data/redis/core/script/DigestUtils.java +++ b/src/main/java/org/springframework/data/redis/core/script/DigestUtils.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. @@ -60,8 +60,7 @@ private static MessageDigest getDigest(String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException ex) { - String message = String.format("Could not find MessageDigest with algorithm \"%s\"", algorithm); - throw new IllegalStateException(message, ex); + throw new IllegalStateException("MessageDigest with algorithm '%s' not found".formatted(algorithm), ex); } } } diff --git a/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java index b9b765d96f..a8e1402a45 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.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. @@ -30,8 +30,8 @@ *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl @@ -45,7 +45,7 @@ public interface ReactiveScriptExecutor { * * @param script must not be {@literal null}. * @return the return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is - * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ default Flux execute(RedisScript script) { return execute(script, Collections.emptyList()); @@ -57,7 +57,7 @@ default Flux execute(RedisScript script) { * @param script must not be {@literal null}. * @param keys must not be {@literal null}. * @return the return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is - * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ default Flux execute(RedisScript script, List keys) { return execute(script, keys, Collections.emptyList()); @@ -67,8 +67,8 @@ default Flux execute(RedisScript script, List keys) { * Executes the given {@link RedisScript} * * @param script The script to execute. Must not be {@literal null}. - * @param keys Any keys that need to be passed to the script. Must not be {@literal null}. - * @param args Any args that need to be passed to the script. Can be {@literal empty}. + * @param keys any keys that need to be passed to the script. Must not be {@literal null}. + * @param args any args that need to be passed to the script. Can be {@literal empty}. * @return The return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") */ @@ -79,8 +79,8 @@ default Flux execute(RedisScript script, List keys) { * arguments and result. * * @param script The script to execute. must not be {@literal null}. - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. * @param argsWriter The {@link RedisElementWriter} to use for serializing args. Must not be {@literal null}. * @param resultReader The {@link RedisElementReader} to use for serializing the script return value. Must not be * {@literal null}. diff --git a/src/main/java/org/springframework/data/redis/core/script/RedisScript.java b/src/main/java/org/springframework/data/redis/core/script/RedisScript.java index 67ec37ed5a..a7cc80f2c2 100644 --- a/src/main/java/org/springframework/data/redis/core/script/RedisScript.java +++ b/src/main/java/org/springframework/data/redis/core/script/RedisScript.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/core/script/ScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java index b7b658a7e4..aa5c160a86 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.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. @@ -30,11 +30,11 @@ public interface ScriptExecutor { /** * Executes the given {@link RedisScript} * - * @param script The script to execute - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script - * @return The return value of the script or null if {@link RedisScript#getResultType()} is null, likely indicating a - * throw-away status reply (i.e. "OK") + * @param script the script to execute. + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. + * @return The return value of the script or {@literal null} if {@link RedisScript#getResultType()} is + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ T execute(RedisScript script, List keys, Object... args); @@ -42,13 +42,13 @@ public interface ScriptExecutor { * Executes the given {@link RedisScript}, using the provided {@link RedisSerializer}s to serialize the script * arguments and result. * - * @param script The script to execute - * @param argsSerializer The {@link RedisSerializer} to use for serializing args - * @param resultSerializer The {@link RedisSerializer} to use for serializing the script return value - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script - * @return The return value of the script or null if {@link RedisScript#getResultType()} is null, likely indicating a - * throw-away status reply (i.e. "OK") + * @param script the script to execute. + * @param argsSerializer The {@link RedisSerializer} to use for serializing args. + * @param resultSerializer The {@link RedisSerializer} to use for serializing the script return value. + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. + * @return The return value of the script or {@literal null} if {@link RedisScript#getResultType()} is + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSerializer resultSerializer, List keys, Object... args); diff --git a/src/main/java/org/springframework/data/redis/core/script/ScriptUtils.java b/src/main/java/org/springframework/data/redis/core/script/ScriptUtils.java index e55dd813b6..24df5ae572 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ScriptUtils.java +++ b/src/main/java/org/springframework/data/redis/core/script/ScriptUtils.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/core/script/ScriptingException.java b/src/main/java/org/springframework/data/redis/core/script/ScriptingException.java index 09315fb6a7..c0794c828e 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ScriptingException.java +++ b/src/main/java/org/springframework/data/redis/core/script/ScriptingException.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/core/types/Expiration.java b/src/main/java/org/springframework/data/redis/core/types/Expiration.java index 81930db228..74eb9c3838 100644 --- a/src/main/java/org/springframework/data/redis/core/types/Expiration.java +++ b/src/main/java/org/springframework/data/redis/core/types/Expiration.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/core/types/RedisClientInfo.java b/src/main/java/org/springframework/data/redis/core/types/RedisClientInfo.java index 898c25b180..e480d995a0 100644 --- a/src/main/java/org/springframework/data/redis/core/types/RedisClientInfo.java +++ b/src/main/java/org/springframework/data/redis/core/types/RedisClientInfo.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. @@ -269,13 +269,12 @@ public static class RedisClientInfoBuilder { public static RedisClientInfo fromString(String source) { - Assert.notNull(source, "Cannot read client properties form 'null'"); + Assert.notNull(source, "Cannot read client properties from 'null'"); Properties properties = new Properties(); try { properties.load(new StringReader(source.replace(' ', '\n'))); } catch (IOException ex) { - String message = String.format("Properties could not be loaded from String '%s'", source); - throw new IllegalArgumentException(message, ex); + throw new IllegalArgumentException("Properties could not be loaded from String '%s'".formatted(source), ex); } return new RedisClientInfo(properties); } diff --git a/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java b/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java index 4d00e271d1..77e5aa10ef 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.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. @@ -15,10 +15,11 @@ */ package org.springframework.data.redis.domain.geo; +import java.io.Serial; + import org.springframework.data.geo.Distance; import org.springframework.data.geo.Metric; import org.springframework.data.geo.Shape; -import org.springframework.data.redis.connection.RedisGeoCommands; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; @@ -31,6 +32,7 @@ */ public class BoundingBox implements Shape { + @Serial private static final long serialVersionUID = 5215611530535947924L; private final Distance width; @@ -94,10 +96,9 @@ public boolean equals(@Nullable Object o) { if (this == o) { return true; } - if (!(o instanceof BoundingBox)) { + if (!(o instanceof BoundingBox that)) { return false; } - BoundingBox that = (BoundingBox) o; if (!ObjectUtils.nullSafeEquals(width, that.width)) { return false; } @@ -106,6 +107,6 @@ public boolean equals(@Nullable Object o) { @Override public String toString() { - return String.format("Bounding box: [width=%s, height=%s]", width, height); + return "Bounding box: [width=%s, height=%s]".formatted(width, height); } } diff --git a/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java b/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java index 00f410fd37..7802726248 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.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/domain/geo/GeoLocation.java b/src/main/java/org/springframework/data/redis/domain/geo/GeoLocation.java index bd570afab6..3ed71bdbc5 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/GeoLocation.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/GeoLocation.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. @@ -16,7 +16,6 @@ package org.springframework.data.redis.domain.geo; import org.springframework.data.geo.Point; -import org.springframework.data.redis.connection.RedisGeoCommands; import org.springframework.lang.Nullable; import org.springframework.util.ObjectUtils; @@ -49,12 +48,10 @@ public boolean equals(@Nullable Object o) { return true; } - if (!(o instanceof GeoLocation)) { + if (!(o instanceof GeoLocation that)) { return false; } - GeoLocation that = (GeoLocation) o; - if (!ObjectUtils.nullSafeEquals(name, that.name)) { return false; } diff --git a/src/main/java/org/springframework/data/redis/domain/geo/GeoReference.java b/src/main/java/org/springframework/data/redis/domain/geo/GeoReference.java index b3d728e0b6..75fe501422 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/GeoReference.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/GeoReference.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. @@ -133,10 +133,9 @@ public boolean equals(@Nullable Object o) { if (this == o) { return true; } - if (!(o instanceof GeoReference.GeoMemberReference)) { + if (!(o instanceof GeoMemberReference that)) { return false; } - GeoMemberReference that = (GeoMemberReference) o; return ObjectUtils.nullSafeEquals(member, that.member); } @@ -178,10 +177,9 @@ public boolean equals(@Nullable Object o) { if (this == o) { return true; } - if (!(o instanceof GeoReference.GeoCoordinateReference)) { + if (!(o instanceof GeoCoordinateReference that)) { return false; } - GeoCoordinateReference that = (GeoCoordinateReference) o; if (longitude != that.longitude) { return false; } diff --git a/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java b/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java index c3ddf47818..e324ed41b7 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.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/domain/geo/Metrics.java b/src/main/java/org/springframework/data/redis/domain/geo/Metrics.java index f79b5983aa..8c8064a497 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/Metrics.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/Metrics.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/domain/geo/RadiusShape.java b/src/main/java/org/springframework/data/redis/domain/geo/RadiusShape.java index d8b8213e5a..24d8d61b9a 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/RadiusShape.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/RadiusShape.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/hash/BeanUtilsHashMapper.java b/src/main/java/org/springframework/data/redis/hash/BeanUtilsHashMapper.java index ad85827105..98887bfdcb 100644 --- a/src/main/java/org/springframework/data/redis/hash/BeanUtilsHashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/BeanUtilsHashMapper.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. @@ -71,7 +71,7 @@ public Map toHash(T object) { return result; } catch (Exception ex) { - throw new IllegalArgumentException(String.format("Cannot describe object %s", object), ex); + throw new IllegalArgumentException("Cannot describe object %s".formatted(object), ex); } } } diff --git a/src/main/java/org/springframework/data/redis/hash/DecoratingStringHashMapper.java b/src/main/java/org/springframework/data/redis/hash/DecoratingStringHashMapper.java index ebbeecfa48..33984c0e01 100644 --- a/src/main/java/org/springframework/data/redis/hash/DecoratingStringHashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/DecoratingStringHashMapper.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/hash/HashMapper.java b/src/main/java/org/springframework/data/redis/hash/HashMapper.java index d7c8e18b72..0ec97f1e89 100644 --- a/src/main/java/org/springframework/data/redis/hash/HashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/HashMapper.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/hash/Jackson2HashMapper.java b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java index e33243b6b0..8788c41ba4 100644 --- a/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.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. @@ -15,23 +15,12 @@ */ package org.springframework.data.redis.hash; -import static com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping.EVERYTHING; +import static com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping.*; import java.io.IOException; import java.text.ParseException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; import org.springframework.data.mapping.MappingException; import org.springframework.data.redis.support.collections.CollectionUtils; @@ -76,7 +65,6 @@ * Flattening requires all property names to not interfere with JSON paths. Using dots or brackets in map keys or as * property names is not supported using flattening. The resulting hash cannot be mapped back into an Object. *

Example

- *

*

  * class Person {
  * 	String firstname;
@@ -188,7 +176,7 @@ public boolean useForType(JavaType type) {
 							return false;
 						}
 
-						if (flatten && type.isTypeOrSubTypeOf(Number.class)) {
+						if (flatten && (type.isTypeOrSubTypeOf(Number.class) || type.isEnumType())) {
 							return false;
 						}
 
@@ -379,13 +367,11 @@ private void doFlatten(String propertyPrefix, Iterator>
 
 	private void flattenElement(String propertyPrefix, Object source, Map resultMap) {
 
-		if (!(source instanceof JsonNode)) {
+		if (!(source instanceof JsonNode element)) {
 			resultMap.put(propertyPrefix, source);
 			return;
 		}
 
-		JsonNode element = (JsonNode) source;
-
 		if (element.isArray()) {
 
 			Iterator nodes = element.elements();
@@ -425,8 +411,7 @@ private void flattenElement(String propertyPrefix, Object source, Map doDestroy() {
 	 */
 	public Collection getActiveSubscriptions() {
 
-		return subscriptions.entrySet().stream().filter(entry -> entry.getValue().hasRegistration())
-				.map(Map.Entry::getKey).collect(Collectors.toList());
+		return subscriptions.entrySet().stream().filter(entry -> entry.getValue().hasRegistration()).map(Map.Entry::getKey)
+				.collect(Collectors.toList());
 	}
 
 	/**
@@ -295,8 +295,7 @@ public  Flux> receive(Iterable topics, Seri
 		}
 
 		return doReceive(channelSerializer, messageSerializer,
-				getRequiredConnection().pubSubCommands().createSubscription(subscriptionListener), patterns,
-				channels);
+				getRequiredConnection().pubSubCommands().createSubscription(subscriptionListener), patterns, channels);
 	}
 
 	private  Flux> doReceive(SerializationPair channelSerializer,
@@ -361,7 +360,7 @@ public  Mono>> receiveLater(Iterable t
 
 			return doReceiveLater(channelSerializer, messageSerializer,
 					getRequiredConnection().pubSubCommands().createSubscription(readyListener), patterns, channels)
-							.delayUntil(it -> readyListener.getTrigger());
+					.delayUntil(it -> readyListener.getTrigger());
 		});
 	}
 
@@ -441,7 +440,7 @@ private ByteBuffer[] getTargets(Iterable topics, Class class
 	private  Message readMessage(RedisElementReader channelSerializer,
 			RedisElementReader messageSerializer, Message message) {
 
-		if (message instanceof PatternMessage) {
+		if (message instanceof PatternMessage) {
 
 			PatternMessage patternMessage = (PatternMessage) message;
 
diff --git a/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java
index 172a3f825d..a563bdb1ed 100644
--- a/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java
+++ b/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.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.
@@ -101,6 +101,7 @@
  * @author Thomas Darimont
  * @author Mark Paluch
  * @author John Blum
+ * @author Seongjun Lee
  * @see MessageListener
  * @see SubscriptionListener
  */
@@ -117,7 +118,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
 	public static final long DEFAULT_SUBSCRIPTION_REGISTRATION_WAIT_TIME = 2000L;
 
 	/**
-	 * Default thread name prefix: "RedisListeningContainer-".
+	 * Default thread name prefix: "RedisMessageListenerContainer-".
 	 */
 	public static final String DEFAULT_THREAD_NAME_PREFIX = ClassUtils.getShortName(RedisMessageListenerContainer.class)
 			+ "-";
@@ -554,8 +555,8 @@ public final boolean isActive() {
 	 * Adds a message listener to the (potentially running) container. If the container is running, the listener starts
 	 * receiving (matching) messages as soon as possible.
 	 *
-	 * @param listener message listener
-	 * @param topics message listener topic
+	 * @param listener message listener.
+	 * @param topics message listener topic.
 	 */
 	public void addMessageListener(MessageListener listener, Collection topics) {
 		addListener(listener, topics);
@@ -565,8 +566,8 @@ public void addMessageListener(MessageListener listener, Collection topics) {
 		removeListener(listener, topics);
@@ -593,8 +594,8 @@ public void removeMessageListener(@Nullable MessageListener listener, Collection
 	 * Note that this method obeys the Redis (p)unsubscribe semantics - meaning an empty/null collection will remove
 	 * listener from all channels.
 	 *
-	 * @param listener message listener
-	 * @param topic message topic
+	 * @param listener message listener.
+	 * @param topic message topic.
 	 */
 	public void removeMessageListener(@Nullable MessageListener listener, Topic topic) {
 		removeMessageListener(listener, Collections.singleton(topic));
@@ -604,7 +605,7 @@ public void removeMessageListener(@Nullable MessageListener listener, Topic topi
 	 * Removes the given message listener completely (from all topics). If the container is running, the listener stops
 	 * receiving (matching) messages as soon as possible.
 	 *
-	 * @param listener message listener
+	 * @param listener message listener.
 	 */
 	public void removeMessageListener(MessageListener listener) {
 
@@ -657,14 +658,14 @@ private void addListener(MessageListener listener, Collection t
 				Collection collection = resolveMessageListeners(this.channelMapping, serializedTopic);
 				collection.add(listener);
 				channels.add(serializedTopic.getArray());
-				logTrace(() -> String.format("Adding listener '%s' on channel '%s'", listener, topic.getTopic()));
+				logTrace(() -> "Adding listener '%s' on channel '%s'".formatted(listener, topic.getTopic()));
 			} else if (topic instanceof PatternTopic) {
 				Collection collection = resolveMessageListeners(this.patternMapping, serializedTopic);
 				collection.add(listener);
 				patterns.add(serializedTopic.getArray());
-				logTrace(() -> String.format("Adding listener '%s' for pattern '%s'", listener, topic.getTopic()));
+				logTrace(() -> "Adding listener '%s' for pattern '%s'".formatted(listener, topic.getTopic()));
 			} else {
-				throw new IllegalArgumentException(String.format("Unknown topic type '%s'", topic.getClass()));
+				throw new IllegalArgumentException("Unknown topic type '%s'".formatted(topic.getClass()));
 			}
 		}
 		boolean wasListening = isListening();
@@ -748,12 +749,12 @@ private void removeListener(@Nullable MessageListener listener, Collection String.format("Removing listener '%s' from channel '%s'", listener, topic.getTopic()));
+				logTrace(() -> "Removing listener '%s' from channel '%s'".formatted(listener, topic.getTopic()));
 			}
 
 			else if (topic instanceof PatternTopic) {
 				remove(listener, topic, holder, patternMapping, patternsToRemove);
-				logTrace(() -> String.format("Removing listener '%s' from pattern '%s'", listener, topic.getTopic()));
+				logTrace(() -> "Removing listener '%s' from pattern '%s'".formatted(listener, topic.getTopic()));
 			}
 		}
 
@@ -770,33 +771,35 @@ else if (isListening()) {
 	}
 
 	private void remove(@Nullable MessageListener listener, Topic topic, ByteArrayWrapper holder,
-			Map> mapping, List topicToRemove) {
+						Map> mapping, List topicToRemove) {
 
 		Collection listeners = mapping.get(holder);
-		Collection listenersToRemove = null;
-
-		if (listeners != null) {
-			// remove only one listener
-			listeners.remove(listener);
-			listenersToRemove = Collections.singletonList(listener);
-
-			// start removing listeners
-			for (MessageListener messageListener : listenersToRemove) {
-				Set topics = listenerTopics.get(messageListener);
-				if (topics != null) {
-					topics.remove(topic);
-				}
-				if (CollectionUtils.isEmpty(topics)) {
-					listenerTopics.remove(messageListener);
-				}
-			}
+		if (CollectionUtils.isEmpty(listeners)) {
+			return;
+		}
 
-			// if we removed everything, remove the empty holder collection
-			if (listeners.isEmpty()) {
-				mapping.remove(holder);
-				topicToRemove.add(holder.getArray());
+		Collection listenersToRemove = (listener == null) ? new ArrayList<>(listeners)
+				: Collections.singletonList(listener);
+
+		// Remove the specified listener(s) from the original collection
+		listeners.removeAll(listenersToRemove);
+
+		// Start removing listeners
+		for (MessageListener messageListener : listenersToRemove) {
+			Set topics = listenerTopics.get(messageListener);
+			if (topics != null) {
+				topics.remove(topic);
+			}
+			if (CollectionUtils.isEmpty(topics)) {
+				listenerTopics.remove(messageListener);
 			}
 		}
+
+		// If all listeners were removed, clean up the mapping and the holder
+		if (listeners.isEmpty()) {
+			mapping.remove(holder);
+			topicToRemove.add(holder.getArray());
+		}
 	}
 
 	private Subscriber createSubscriber(RedisConnectionFactory connectionFactory, Executor executor) {
@@ -874,9 +877,8 @@ protected void handleSubscriptionException(CompletableFuture future, BackO
 				long recoveryInterval = backOffExecution.nextBackOff();
 
 				if (recoveryInterval != BackOffExecution.STOP) {
-					String message = String.format("Connection failure occurred: %s; Restarting subscription task after %s ms",
-							cause, recoveryInterval);
-					logger.error(message, cause);
+					logger.error("Connection failure occurred: %s; Restarting subscription task after %s ms".formatted(cause,
+							recoveryInterval), cause);
 				}
 
 				return recoveryInterval;
diff --git a/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java b/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java
index 14210d859c..050e425f3d 100644
--- a/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java
+++ b/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.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/listener/Topic.java b/src/main/java/org/springframework/data/redis/listener/Topic.java
index 23f9b6f2d3..0aad48207a 100644
--- a/src/main/java/org/springframework/data/redis/listener/Topic.java
+++ b/src/main/java/org/springframework/data/redis/listener/Topic.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/listener/adapter/MessageListenerAdapter.java b/src/main/java/org/springframework/data/redis/listener/adapter/MessageListenerAdapter.java
index 2152b4fad9..fb7d827728 100644
--- a/src/main/java/org/springframework/data/redis/listener/adapter/MessageListenerAdapter.java
+++ b/src/main/java/org/springframework/data/redis/listener/adapter/MessageListenerAdapter.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.
@@ -375,13 +375,12 @@ protected void invokeListenerMethod(String methodName, Object[] arguments) {
 			if (targetEx instanceof DataAccessException dataAccessException) {
 				throw dataAccessException;
 			} else {
-				String message = String.format("Listener method '%s' threw exception", methodName);
-				throw new RedisListenerExecutionFailedException(message, targetEx);
+				throw new RedisListenerExecutionFailedException("Listener method '%s' threw exception".formatted(methodName),
+						targetEx);
 			}
 		} catch (Throwable ex) {
-			String message = String.format("Failed to invoke target method '%s' with arguments %s", methodName,
-					ObjectUtils.nullSafeToString(arguments));
-			throw new RedisListenerExecutionFailedException(message, ex);
+			throw new RedisListenerExecutionFailedException("Failed to invoke target method '%s' with arguments %s"
+					.formatted(methodName, ObjectUtils.nullSafeToString(arguments)), ex);
 		}
 	}
 
diff --git a/src/main/java/org/springframework/data/redis/listener/adapter/RedisListenerExecutionFailedException.java b/src/main/java/org/springframework/data/redis/listener/adapter/RedisListenerExecutionFailedException.java
index 8a07b95c36..ff22789d16 100644
--- a/src/main/java/org/springframework/data/redis/listener/adapter/RedisListenerExecutionFailedException.java
+++ b/src/main/java/org/springframework/data/redis/listener/adapter/RedisListenerExecutionFailedException.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/repository/cdi/CdiBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java
index bdb9248f6f..275ed2fd08 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/CdiBean.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.
@@ -149,8 +149,7 @@ public final void initialize() {
 	public void destroy(T instance, CreationalContext creationalContext) {
 
 		if (log.isDebugEnabled()) {
-			log.debug(String.format("Destroying bean instance %s for repository type '%s'.", instance.toString(),
-					beanClass.getName()));
+			log.debug("Destroying bean instance %s for repository type '%s'".formatted(instance, beanClass.getName()));
 		}
 
 		creationalContext.release();
@@ -206,7 +205,7 @@ public String getId() {
 
 	@Override
 	public String toString() {
-		return String.format("CdiBean: type='%s', qualifiers=%s", beanClass.getName(), qualifiers.toString());
+		return "CdiBean: type='%s', qualifiers=%s".formatted(beanClass.getName(), qualifiers.toString());
 	}
 
 }
diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java
index 9a1a8988b8..0220531079 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueAdapterBean.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.
@@ -70,8 +70,7 @@ private Type getBeanType() {
 				return type;
 			}
 
-			if (type instanceof ParameterizedType) {
-				ParameterizedType parameterizedType = (ParameterizedType) type;
+			if (type instanceof ParameterizedType parameterizedType) {
 				if (parameterizedType.getRawType() instanceof Class
 						&& RedisOperations.class.isAssignableFrom((Class) parameterizedType.getRawType())) {
 					return type;
diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java
index eb6dc61941..e1f80694be 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisKeyValueTemplateBean.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/repository/cdi/RedisRepositoryBean.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java
index efd211928a..8a85c7bde4 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryBean.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/repository/cdi/RedisRepositoryExtension.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java
index c445925f6e..69469551fc 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.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.
@@ -80,7 +80,7 @@  void processBean(@Observes ProcessBean processBean) {
 
 			if (beanType instanceof Class && RedisKeyValueTemplate.class.isAssignableFrom((Class) beanType)) {
 				if (log.isDebugEnabled()) {
-					log.debug(String.format("Discovered %s with qualifiers %s.", RedisKeyValueTemplate.class.getName(),
+					log.debug("Discovered %s with qualifiers %s.".formatted(RedisKeyValueTemplate.class.getName(),
 							bean.getQualifiers()));
 				}
 
@@ -90,7 +90,7 @@  void processBean(@Observes ProcessBean processBean) {
 
 			if (beanType instanceof Class && RedisKeyValueAdapter.class.isAssignableFrom((Class) beanType)) {
 				if (log.isDebugEnabled()) {
-					log.debug(String.format("Discovered %s with qualifiers %s.", RedisKeyValueAdapter.class.getName(),
+					log.debug("Discovered %s with qualifiers %s.".formatted(RedisKeyValueAdapter.class.getName(),
 							bean.getQualifiers()));
 				}
 
@@ -100,7 +100,8 @@  void processBean(@Observes ProcessBean processBean) {
 
 			if (beanType instanceof Class && RedisOperations.class.isAssignableFrom((Class) beanType)) {
 				if (log.isDebugEnabled()) {
-					log.debug(String.format("Discovered %s with qualifiers %s.", RedisOperations.class.getName(),
+					log.debug(
+							"Discovered %s with qualifiers %s.".formatted(RedisOperations.class.getName(),
 							bean.getQualifiers()));
 				}
 
@@ -123,7 +124,7 @@ void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanMan
 			CdiRepositoryBean repositoryBean = createRepositoryBean(repositoryType, qualifiers, beanManager);
 
 			if (log.isInfoEnabled()) {
-				log.info(String.format("Registering bean for %s with qualifiers %s.", repositoryType.getName(), qualifiers));
+				log.info("Registering bean for %s with qualifiers %s.".formatted(repositoryType.getName(), qualifiers));
 			}
 
 			// Register the bean to the container.
@@ -148,7 +149,7 @@ private void registerDependenciesIfNecessary(@Observes AfterBeanDiscovery afterB
 
 			if (!redisKeyValueAdapters.containsKey(qualifiers)) {
 				if (log.isInfoEnabled()) {
-					log.info(String.format("Registering bean for %s with qualifiers %s.", RedisKeyValueAdapter.class.getName(),
+					log.info("Registering bean for %s with qualifiers %s.".formatted(RedisKeyValueAdapter.class.getName(),
 							qualifiers));
 				}
 				RedisKeyValueAdapterBean redisKeyValueAdapterBean = createRedisKeyValueAdapterBean(qualifiers, beanManager);
@@ -158,7 +159,7 @@ private void registerDependenciesIfNecessary(@Observes AfterBeanDiscovery afterB
 
 			if (!redisKeyValueTemplates.containsKey(qualifiers)) {
 				if (log.isInfoEnabled()) {
-					log.info(String.format("Registering bean for %s with qualifiers %s.", RedisKeyValueTemplate.class.getName(),
+					log.info("Registering bean for %s with qualifiers %s.".formatted(RedisKeyValueTemplate.class.getName(),
 							qualifiers));
 				}
 
@@ -186,8 +187,8 @@ private  CdiRepositoryBean createRepositoryBean(Class repositoryType, S
 		Bean redisKeyValueTemplate = this.redisKeyValueTemplates.get(qualifiers);
 
 		if (redisKeyValueTemplate == null) {
-			throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
-					RedisKeyValueTemplate.class.getName(), qualifiers));
+			throw new UnsatisfiedResolutionException("Unable to resolve a bean for '%s' with qualifiers %s"
+					.formatted(RedisKeyValueTemplate.class.getName(), qualifiers));
 		}
 
 		// Construct and return the repository bean.
@@ -208,8 +209,8 @@ private RedisKeyValueAdapterBean createRedisKeyValueAdapterBean(Set
 		Bean> redisOperationsBean = this.redisOperations.get(qualifiers);
 
 		if (redisOperationsBean == null) {
-			throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
-					RedisOperations.class.getName(), qualifiers));
+			throw new UnsatisfiedResolutionException("Unable to resolve a bean for '%s' with qualifiers %s."
+					.formatted(RedisOperations.class.getName(), qualifiers));
 		}
 
 		// Construct and return the repository bean.
@@ -230,8 +231,8 @@ private RedisKeyValueTemplateBean createRedisKeyValueTemplateBean(Set redisKeyValueAdapterBean = this.redisKeyValueAdapters.get(qualifiers);
 
 		if (redisKeyValueAdapterBean == null) {
-			throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
-					RedisKeyValueAdapter.class.getName(), qualifiers));
+			throw new UnsatisfiedResolutionException("Unable to resolve a bean for '%s' with qualifiers %s"
+					.formatted(RedisKeyValueAdapter.class.getName(), qualifiers));
 		}
 
 		// Construct and return the repository bean.
diff --git a/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java b/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java
index eea89db92b..8bc81073aa 100644
--- a/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java
+++ b/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.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/repository/configuration/RedisRepositoriesRegistrar.java b/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrar.java
index 21f255f2e6..a681bfb89f 100644
--- a/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrar.java
+++ b/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrar.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/repository/configuration/RedisRepositoryConfigurationExtension.java b/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtension.java
index 728cab6d19..5d008d5cd1 100644
--- a/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtension.java
+++ b/src/main/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtension.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/repository/core/MappingRedisEntityInformation.java b/src/main/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformation.java
index c05d61f12c..207ab0f5bc 100644
--- a/src/main/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformation.java
+++ b/src/main/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformation.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.
@@ -40,10 +40,9 @@ public MappingRedisEntityInformation(RedisPersistentEntity entity) {
 		super(entity);
 
 		if (!entity.hasIdProperty()) {
-
 			throw new MappingException(
-					String.format("Entity %s requires to have an explicit id field; Did you forget to provide one using @Id",
-							entity.getName()));
+					("Entity %s requires to have an explicit id field;" + " Did you forget to provide one using @Id")
+							.formatted(entity.getName()));
 		}
 	}
 }
diff --git a/src/main/java/org/springframework/data/redis/repository/core/RedisEntityInformation.java b/src/main/java/org/springframework/data/redis/repository/core/RedisEntityInformation.java
index 7b6a7b1e71..e2568dad64 100644
--- a/src/main/java/org/springframework/data/redis/repository/core/RedisEntityInformation.java
+++ b/src/main/java/org/springframework/data/redis/repository/core/RedisEntityInformation.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/repository/query/ExampleQueryMapper.java b/src/main/java/org/springframework/data/redis/repository/query/ExampleQueryMapper.java
index fe82d0327e..9a42260958 100644
--- a/src/main/java/org/springframework/data/redis/repository/query/ExampleQueryMapper.java
+++ b/src/main/java/org/springframework/data/redis/repository/query/ExampleQueryMapper.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.
@@ -139,8 +139,8 @@ private void applyPropertySpec(String path, Predicate hasIndex, ExampleM
 
 		if (!SUPPORTED_MATCHERS.contains(stringMatcher)) {
 			throw new InvalidDataAccessApiUsageException(
-					String.format("Redis Query-by-Example does not support string matcher %s; Supported matchers are: %s.",
-							stringMatcher, SUPPORTED_MATCHERS));
+					("Redis Query-by-Example does not support string matcher %s;" + " Supported matchers are: %s.")
+							.formatted(stringMatcher, SUPPORTED_MATCHERS));
 		}
 
 		if (exampleSpecAccessor.hasPropertySpecifier(path)) {
diff --git a/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java b/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java
index c8eab2d3a4..e6985cd4db 100644
--- a/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java
+++ b/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.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/repository/query/RedisPartTreeQuery.java b/src/main/java/org/springframework/data/redis/repository/query/RedisPartTreeQuery.java
index 8ba04ac02e..5582f36cc4 100644
--- a/src/main/java/org/springframework/data/redis/repository/query/RedisPartTreeQuery.java
+++ b/src/main/java/org/springframework/data/redis/repository/query/RedisPartTreeQuery.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2024 the original author or authors.
+ * Copyright 2024-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/src/main/java/org/springframework/data/redis/repository/query/RedisQueryCreator.java b/src/main/java/org/springframework/data/redis/repository/query/RedisQueryCreator.java
index bb5d7dae69..2fbf28d2d0 100644
--- a/src/main/java/org/springframework/data/redis/repository/query/RedisQueryCreator.java
+++ b/src/main/java/org/springframework/data/redis/repository/query/RedisQueryCreator.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.repository.query;
 
+import java.util.Collection;
 import java.util.Iterator;
 
 import org.springframework.dao.InvalidDataAccessApiUsageException;
@@ -29,6 +30,8 @@
 import org.springframework.data.repository.query.parser.AbstractQueryCreator;
 import org.springframework.data.repository.query.parser.Part;
 import org.springframework.data.repository.query.parser.PartTree;
+import org.springframework.lang.Nullable;
+import org.springframework.util.ClassUtils;
 import org.springframework.util.CollectionUtils;
 
 /**
@@ -37,6 +40,7 @@
  * @author Christoph Strobl
  * @author Mark Paluch
  * @author John Blum
+ * @author Junghoon Ban
  * @since 1.7
  */
 public class RedisQueryCreator extends AbstractQueryCreator, RedisOperationChain> {
@@ -57,10 +61,8 @@ private RedisOperationChain from(Part part, Iterator iterator, RedisOper
 			case TRUE -> sink.sismember(part.getProperty().toDotPath(), true);
 			case FALSE -> sink.sismember(part.getProperty().toDotPath(), false);
 			case WITHIN, NEAR -> sink.near(getNearPath(part, iterator));
-			default -> {
-				String message = String.format("%s is not supported for Redis query derivation", part.getType());
-				throw new IllegalArgumentException(message);
-			}
+			default ->
+				throw new IllegalArgumentException("%s is not supported for Redis query derivation".formatted(part.getType()));
 		}
 
 		return sink;
@@ -78,17 +80,15 @@ protected RedisOperationChain or(RedisOperationChain base, RedisOperationChain c
 	}
 
 	@Override
-	protected KeyValueQuery complete(final RedisOperationChain criteria, Sort sort) {
+	protected KeyValueQuery complete(@Nullable RedisOperationChain criteria, Sort sort) {
 
 		KeyValueQuery query = new KeyValueQuery<>(criteria);
 
-		if (query.getCriteria() != null && !CollectionUtils.isEmpty(query.getCriteria().getSismember())
-				&& !CollectionUtils.isEmpty(query.getCriteria().getOrSismember()))
-			if (query.getCriteria().getSismember().size() == 1 && query.getCriteria().getOrSismember().size() == 1) {
-
-				query.getCriteria().getOrSismember().add(query.getCriteria().getSismember().iterator().next());
-				query.getCriteria().getSismember().clear();
-			}
+		if (criteria != null && containsExactlyOne(criteria.getSismember())
+				&& containsExactlyOne(criteria.getOrSismember())) {
+			criteria.getOrSismember().addAll(criteria.getSismember());
+			criteria.getSismember().clear();
+		}
 
 		if (sort.isSorted()) {
 			query.setSort(sort);
@@ -99,43 +99,42 @@ protected KeyValueQuery complete(final RedisOperationChain
 
 	private NearPath getNearPath(Part part, Iterator iterator) {
 
+		String path = part.getProperty().toDotPath();
 		Object value = iterator.next();
 
-		Point point;
-		Distance distance;
-
-		if (value instanceof Circle) {
-			point = ((Circle) value).getCenter();
-			distance = ((Circle) value).getRadius();
-		} else if (value instanceof Point) {
+		if (value instanceof Circle circle) {
+			return new NearPath(path, circle.getCenter(), circle.getRadius());
+		}
 
-			point = (Point) value;
+		if (value instanceof Point point) {
 
 			if (!iterator.hasNext()) {
-				String message = "Expected to find distance value for geo query; Are you missing a parameter";
-				throw new InvalidDataAccessApiUsageException(message);
+				throw new InvalidDataAccessApiUsageException(
+						"Expected to find distance value for geo query;" + " Are you missing a parameter?");
 			}
 
+			Distance distance;
 			Object distObject = iterator.next();
-			if (distObject instanceof Distance) {
-				distance = (Distance) distObject;
-			} else if (distObject instanceof Number) {
-				distance = new Distance(((Number) distObject).doubleValue(), Metrics.KILOMETERS);
-			} else {
 
-				String message = String.format("Expected to find Distance or Numeric value for geo query but was %s",
-						distObject.getClass());
+			if (distObject instanceof Distance dist) {
+				distance = dist;
+			} else if (distObject instanceof Number num) {
+				distance = new Distance(num.doubleValue(), Metrics.KILOMETERS);
+			} else {
 
-				throw new InvalidDataAccessApiUsageException(message);
+				throw new InvalidDataAccessApiUsageException(
+						"Expected to find Distance or Numeric value for geo query but was %s"
+								.formatted(ClassUtils.getDescriptiveType(distObject)));
 			}
-		} else {
-
-			String message = String.format("Expected to find a Circle or Point/Distance for geo query but was %s.",
-					value.getClass());
 
-			throw new InvalidDataAccessApiUsageException(message);
+			return new NearPath(path, point, distance);
 		}
 
-		return new NearPath(part.getProperty().toDotPath(), point, distance);
+		throw new InvalidDataAccessApiUsageException("Expected to find a Circle or Point/Distance for geo query but was %s"
+				.formatted(ClassUtils.getDescriptiveType(value.getClass())));
+	}
+
+	private static boolean containsExactlyOne(Collection collection) {
+		return !CollectionUtils.isEmpty(collection) && collection.size() == 1;
 	}
 }
diff --git a/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java b/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java
index 6a3a9584d2..44704c6096 100644
--- a/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java
+++ b/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.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/repository/support/RedisRepositoryFactory.java b/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactory.java
index 5197d7665c..d6787357dc 100644
--- a/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactory.java
+++ b/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactory.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/repository/support/RedisRepositoryFactoryBean.java b/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactoryBean.java
index b0ecb53970..37cf0896c5 100644
--- a/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactoryBean.java
+++ b/src/main/java/org/springframework/data/redis/repository/support/RedisRepositoryFactoryBean.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/serializer/ByteArrayRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/ByteArrayRedisSerializer.java
index 57a2cb9e57..cb24add7a0 100644
--- a/src/main/java/org/springframework/data/redis/serializer/ByteArrayRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/ByteArrayRedisSerializer.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/serializer/DefaultRedisElementReader.java b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementReader.java
index 0be8d02331..be012f84d0 100644
--- a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementReader.java
+++ b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementReader.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/serializer/DefaultRedisElementWriter.java b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementWriter.java
index 43fa91fa2d..e6f75c5f70 100644
--- a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementWriter.java
+++ b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisElementWriter.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.
@@ -18,6 +18,7 @@
 import java.nio.ByteBuffer;
 
 import org.springframework.lang.Nullable;
+import org.springframework.util.ObjectUtils;
 
 /**
  * Default implementation of {@link RedisElementWriter}.
@@ -38,7 +39,8 @@ class DefaultRedisElementWriter implements RedisElementWriter {
 	public ByteBuffer write(@Nullable T value) {
 
 		if (serializer != null && (value == null || serializer.canSerialize(value.getClass()))) {
-			return ByteBuffer.wrap(serializer.serialize(value));
+			byte[] serializedValue = serializer.serialize(value);
+			return serializedValue != null ? ByteBuffer.wrap(serializedValue) : ByteBuffer.wrap(new byte[0]);
 		}
 
 		if (value instanceof byte[]) {
@@ -50,6 +52,6 @@ public ByteBuffer write(@Nullable T value) {
 		}
 
 		throw new IllegalStateException(
-				String.format("Cannot serialize value of type %s without a serializer", value.getClass()));
+				"Cannot serialize value of type %s without a serializer".formatted(ObjectUtils.nullSafeClassName(value)));
 	}
 }
diff --git a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java
index 8232b17db8..b302ea64b9 100644
--- a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java
+++ b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.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/serializer/DefaultSerializationPair.java b/src/main/java/org/springframework/data/redis/serializer/DefaultSerializationPair.java
index 2e4527d503..9f5f9491ef 100644
--- a/src/main/java/org/springframework/data/redis/serializer/DefaultSerializationPair.java
+++ b/src/main/java/org/springframework/data/redis/serializer/DefaultSerializationPair.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/serializer/GenericJackson2JsonRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializer.java
index 28b9474b26..616ab9de70 100644
--- a/src/main/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializer.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.
@@ -60,6 +60,7 @@
  * @author Mark Paluch
  * @author Mao Shuai
  * @author John Blum
+ * @author Anne Lee
  * @see org.springframework.data.redis.serializer.JacksonObjectReader
  * @see org.springframework.data.redis.serializer.JacksonObjectWriter
  * @see com.fasterxml.jackson.databind.ObjectMapper
@@ -92,13 +93,13 @@ public GenericJackson2JsonRedisSerializer() {
 	 * In case {@link String name} is {@literal empty} or {@literal null}, then {@link JsonTypeInfo.Id#CLASS} will be
 	 * used.
 	 *
-	 * @param classPropertyTypeName {@link String name} of the JSON property holding type information; can be
+	 * @param typeHintPropertyName {@link String name} of the JSON property holding type information; can be
 	 *          {@literal null}.
 	 * @see ObjectMapper#activateDefaultTypingAsProperty(PolymorphicTypeValidator, DefaultTyping, String)
 	 * @see ObjectMapper#activateDefaultTyping(PolymorphicTypeValidator, DefaultTyping, As)
 	 */
-	public GenericJackson2JsonRedisSerializer(@Nullable String classPropertyTypeName) {
-		this(classPropertyTypeName, JacksonObjectReader.create(), JacksonObjectWriter.create());
+	public GenericJackson2JsonRedisSerializer(@Nullable String typeHintPropertyName) {
+		this(typeHintPropertyName, JacksonObjectReader.create(), JacksonObjectWriter.create());
 	}
 
 	/**
@@ -109,7 +110,7 @@ public GenericJackson2JsonRedisSerializer(@Nullable String classPropertyTypeName
 	 * In case {@link String name} is {@literal empty} or {@literal null}, then {@link JsonTypeInfo.Id#CLASS} will be
 	 * used.
 	 *
-	 * @param classPropertyTypeName {@link String name} of the JSON property holding type information; can be
+	 * @param typeHintPropertyName {@link String name} of the JSON property holding type information; can be
 	 *          {@literal null}.
 	 * @param reader {@link JacksonObjectReader} function to read objects using {@link ObjectMapper}.
 	 * @param writer {@link JacksonObjectWriter} function to write objects using {@link ObjectMapper}.
@@ -117,21 +118,14 @@ public GenericJackson2JsonRedisSerializer(@Nullable String classPropertyTypeName
 	 * @see ObjectMapper#activateDefaultTyping(PolymorphicTypeValidator, DefaultTyping, As)
 	 * @since 3.0
 	 */
-	public GenericJackson2JsonRedisSerializer(@Nullable String classPropertyTypeName, JacksonObjectReader reader,
+	public GenericJackson2JsonRedisSerializer(@Nullable String typeHintPropertyName, JacksonObjectReader reader,
 			JacksonObjectWriter writer) {
 
-		this(new ObjectMapper(), reader, writer, classPropertyTypeName);
+		this(new ObjectMapper(), reader, writer, typeHintPropertyName);
 
-		registerNullValueSerializer(this.mapper, classPropertyTypeName);
+		registerNullValueSerializer(this.mapper, typeHintPropertyName);
 
-		StdTypeResolverBuilder typer = TypeResolverBuilder.forEverything(this.mapper).init(JsonTypeInfo.Id.CLASS, null)
-				.inclusion(JsonTypeInfo.As.PROPERTY);
-
-		if (StringUtils.hasText(classPropertyTypeName)) {
-			typer = typer.typeProperty(classPropertyTypeName);
-		}
-
-		this.mapper.setDefaultTyping(typer);
+		this.mapper.setDefaultTyping(createDefaultTypeResolverBuilder(getObjectMapper(), typeHintPropertyName));
 	}
 
 	/**
@@ -157,7 +151,6 @@ public GenericJackson2JsonRedisSerializer(ObjectMapper mapper) {
 	 */
 	public GenericJackson2JsonRedisSerializer(ObjectMapper mapper, JacksonObjectReader reader,
 			JacksonObjectWriter writer) {
-
 		this(mapper, reader, writer, null);
 	}
 
@@ -177,7 +170,7 @@ private GenericJackson2JsonRedisSerializer(ObjectMapper mapper, JacksonObjectRea
 		this.typeResolver = newTypeResolver(mapper, typeHintPropertyName, this.defaultTypingEnabled);
 	}
 
-	private TypeResolver newTypeResolver(ObjectMapper mapper, @Nullable String typeHintPropertyName,
+	private static TypeResolver newTypeResolver(ObjectMapper mapper, @Nullable String typeHintPropertyName,
 			Lazy defaultTypingEnabled) {
 
 		Lazy lazyTypeFactory = Lazy.of(mapper::getTypeFactory);
@@ -188,19 +181,17 @@ private TypeResolver newTypeResolver(ObjectMapper mapper, @Nullable String typeH
 		return new TypeResolver(lazyTypeFactory, lazyTypeHintPropertyName);
 	}
 
-	private Lazy newLazyTypeHintPropertyName(ObjectMapper mapper, Lazy defaultTypingEnabled) {
+	private static Lazy newLazyTypeHintPropertyName(ObjectMapper mapper, Lazy defaultTypingEnabled) {
 
 		Lazy configuredTypeDeserializationPropertyName = getConfiguredTypeDeserializationPropertyName(mapper);
 
-		Lazy resolvedLazyTypeHintPropertyName = Lazy.of(() -> defaultTypingEnabled.get() ? null
-				: configuredTypeDeserializationPropertyName.get());
-
-		resolvedLazyTypeHintPropertyName = resolvedLazyTypeHintPropertyName.or("@class");
+		Lazy resolvedLazyTypeHintPropertyName = Lazy
+				.of(() -> defaultTypingEnabled.get() ? null : configuredTypeDeserializationPropertyName.get());
 
-		return resolvedLazyTypeHintPropertyName;
+		return resolvedLazyTypeHintPropertyName.or("@class");
 	}
 
-	private Lazy getConfiguredTypeDeserializationPropertyName(ObjectMapper mapper) {
+	private static Lazy getConfiguredTypeDeserializationPropertyName(ObjectMapper mapper) {
 
 		return Lazy.of(() -> {
 
@@ -215,20 +206,43 @@ private Lazy getConfiguredTypeDeserializationPropertyName(ObjectMapper m
 		});
 	}
 
+	private static StdTypeResolverBuilder createDefaultTypeResolverBuilder(ObjectMapper objectMapper,
+			@Nullable String typeHintPropertyName) {
+
+		StdTypeResolverBuilder typer = TypeResolverBuilder.forEverything(objectMapper).init(JsonTypeInfo.Id.CLASS, null)
+				.inclusion(As.PROPERTY);
+
+		if (StringUtils.hasText(typeHintPropertyName)) {
+			typer = typer.typeProperty(typeHintPropertyName);
+		}
+		return typer;
+	}
+
+	/**
+	 * Factory method returning a {@literal Builder} used to construct and configure a
+	 * {@link GenericJackson2JsonRedisSerializer}.
+	 *
+	 * @return new {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+	 * @since 3.3.1
+	 */
+	public static GenericJackson2JsonRedisSerializerBuilder builder() {
+		return new GenericJackson2JsonRedisSerializerBuilder();
+	}
+
 	/**
 	 * Register {@link NullValueSerializer} in the given {@link ObjectMapper} with an optional
-	 * {@code classPropertyTypeName}. This method should be called by code that customizes
+	 * {@code typeHintPropertyName}. This method should be called by code that customizes
 	 * {@link GenericJackson2JsonRedisSerializer} by providing an external {@link ObjectMapper}.
 	 *
 	 * @param objectMapper the object mapper to customize.
-	 * @param classPropertyTypeName name of the type property. Defaults to {@code @class} if {@literal null}/empty.
+	 * @param typeHintPropertyName name of the type property. Defaults to {@code @class} if {@literal null}/empty.
 	 * @since 2.2
 	 */
-	public static void registerNullValueSerializer(ObjectMapper objectMapper, @Nullable String classPropertyTypeName) {
+	public static void registerNullValueSerializer(ObjectMapper objectMapper, @Nullable String typeHintPropertyName) {
 
 		// Simply setting {@code mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)} does not help here
 		// since we need the type hint embedded for deserialization using the default typing feature.
-		objectMapper.registerModule(new SimpleModule().addSerializer(new NullValueSerializer(classPropertyTypeName)));
+		objectMapper.registerModule(new SimpleModule().addSerializer(new NullValueSerializer(typeHintPropertyName)));
 	}
 
 	/**
@@ -251,12 +265,12 @@ public byte[] serialize(@Nullable Object value) throws SerializationException {
 		try {
 			return writer.write(mapper, value);
 		} catch (IOException ex) {
-			String message = String.format("Could not write JSON: %s", ex.getMessage());
-			throw new SerializationException(message, ex);
+			throw new SerializationException("Could not write JSON: %s".formatted(ex.getMessage()), ex);
 		}
 	}
 
 	@Override
+	@Nullable
 	public Object deserialize(@Nullable byte[] source) throws SerializationException {
 		return deserialize(source, Object.class);
 	}
@@ -288,8 +302,7 @@ public  T deserialize(@Nullable byte[] source, Class type) throws Serializ
 		try {
 			return (T) reader.read(mapper, source, resolveType(source, type));
 		} catch (Exception ex) {
-			String message = String.format("Could not read JSON:%s ", ex.getMessage());
-			throw new SerializationException(message, ex);
+			throw new SerializationException("Could not read JSON:%s ".formatted(ex.getMessage()), ex);
 		}
 	}
 
@@ -365,8 +378,7 @@ protected JavaType resolveType(byte[] source, Class type) throws IOException
 	 */
 	private static class NullValueSerializer extends StdSerializer {
 
-		@Serial
-		private static final long serialVersionUID = 1999052150548658808L;
+		@Serial private static final long serialVersionUID = 1999052150548658808L;
 
 		private final String classIdentifier;
 
@@ -396,6 +408,159 @@ public void serializeWithType(NullValue value, JsonGenerator jsonGenerator, Seri
 		}
 	}
 
+	/**
+	 * Builder for configuring and creating a {@link GenericJackson2JsonRedisSerializer}.
+	 *
+	 * @author Anne Lee
+	 * @author Mark Paluch
+	 * @since 3.3.1
+	 */
+	public static class GenericJackson2JsonRedisSerializerBuilder {
+
+		private @Nullable String typeHintPropertyName;
+
+		private JacksonObjectReader reader = JacksonObjectReader.create();
+
+		private JacksonObjectWriter writer = JacksonObjectWriter.create();
+
+		private @Nullable ObjectMapper objectMapper;
+
+		private @Nullable Boolean defaultTyping;
+
+		private boolean registerNullValueSerializer = true;
+
+		private @Nullable StdSerializer nullValueSerializer;
+
+		private GenericJackson2JsonRedisSerializerBuilder() {}
+
+		/**
+		 * Enable or disable default typing. Enabling default typing will override
+		 * {@link ObjectMapper#setDefaultTyping(com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder)} for a given
+		 * {@link ObjectMapper}. Default typing is enabled by default if no {@link ObjectMapper} is provided.
+		 *
+		 * @param defaultTyping whether to enable/disable default typing. Enabled by default if the {@link ObjectMapper} is
+		 *          not provided.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder defaultTyping(boolean defaultTyping) {
+			this.defaultTyping = defaultTyping;
+			return this;
+		}
+
+		/**
+		 * Configure a property name to that represents the type hint.
+		 *
+		 * @param typeHintPropertyName {@link String name} of the JSON property holding type information.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder typeHintPropertyName(String typeHintPropertyName) {
+
+			Assert.hasText(typeHintPropertyName, "Type hint property name must bot be null or empty");
+
+			this.typeHintPropertyName = typeHintPropertyName;
+			return this;
+		}
+
+		/**
+		 * Configure a provided {@link ObjectMapper}. Note that the provided {@link ObjectMapper} can be reconfigured with a
+		 * {@link #nullValueSerializer} or default typing depending on the builder configuration.
+		 *
+		 * @param objectMapper must not be {@literal null}.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder objectMapper(ObjectMapper objectMapper) {
+
+			Assert.notNull(objectMapper, "ObjectMapper must not be null");
+
+			this.objectMapper = objectMapper;
+			return this;
+		}
+
+		/**
+		 * Configure {@link JacksonObjectReader}.
+		 *
+		 * @param reader must not be {@literal null}.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder reader(JacksonObjectReader reader) {
+
+			Assert.notNull(reader, "JacksonObjectReader must not be null");
+
+			this.reader = reader;
+			return this;
+		}
+
+		/**
+		 * Configure {@link JacksonObjectWriter}.
+		 *
+		 * @param writer must not be {@literal null}.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder writer(JacksonObjectWriter writer) {
+
+			Assert.notNull(writer, "JacksonObjectWriter must not be null");
+
+			this.writer = writer;
+			return this;
+		}
+
+		/**
+		 * Register a {@link StdSerializer serializer} for {@link NullValue}.
+		 *
+		 * @param nullValueSerializer the {@link StdSerializer} to use for {@link NullValue} serialization, must not be
+		 *          {@literal null}.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder nullValueSerializer(StdSerializer nullValueSerializer) {
+
+			Assert.notNull(nullValueSerializer, "Null value serializer must not be null");
+
+			this.nullValueSerializer = nullValueSerializer;
+			return this;
+		}
+
+		/**
+		 * Configure whether to register a {@link StdSerializer serializer} for {@link NullValue} serialization. The default
+		 * serializer considers {@link #typeHintPropertyName(String)}.
+		 *
+		 * @param registerNullValueSerializer {@code true} to register the default serializer; {@code false} otherwise.
+		 * @return this {@link GenericJackson2JsonRedisSerializer.GenericJackson2JsonRedisSerializerBuilder}.
+		 */
+		public GenericJackson2JsonRedisSerializerBuilder registerNullValueSerializer(boolean registerNullValueSerializer) {
+			this.registerNullValueSerializer = registerNullValueSerializer;
+			return this;
+		}
+
+		/**
+		 * Creates a new instance of {@link GenericJackson2JsonRedisSerializer} with configuration options applied. Creates
+		 * also a new {@link ObjectMapper} if none was provided.
+		 *
+		 * @return a new instance of {@link GenericJackson2JsonRedisSerializer}.
+		 */
+		public GenericJackson2JsonRedisSerializer build() {
+
+			ObjectMapper objectMapper = this.objectMapper;
+			boolean providedObjectMapper = objectMapper != null;
+
+			if (objectMapper == null) {
+				objectMapper = new ObjectMapper();
+			}
+
+			if (registerNullValueSerializer) {
+				objectMapper.registerModule(new SimpleModule("GenericJackson2JsonRedisSerializerBuilder")
+						.addSerializer(this.nullValueSerializer != null ? this.nullValueSerializer
+								: new NullValueSerializer(this.typeHintPropertyName)));
+			}
+
+			if ((!providedObjectMapper && (defaultTyping == null || defaultTyping))
+					|| (defaultTyping != null && defaultTyping)) {
+				objectMapper.setDefaultTyping(createDefaultTypeResolverBuilder(objectMapper, typeHintPropertyName));
+			}
+
+			return new GenericJackson2JsonRedisSerializer(objectMapper, this.reader, this.writer, this.typeHintPropertyName);
+		}
+	}
+
 	/**
 	 * Custom {@link StdTypeResolverBuilder} that considers typing for non-primitive types. Primitives, their wrappers and
 	 * primitive arrays do not require type hints. The default {@code DefaultTyping#EVERYTHING} typing does not satisfy
@@ -424,6 +589,7 @@ public ObjectMapper.DefaultTypeResolverBuilder withDefaultImpl(Class defaultI
 		 * Boolean, Integer, Double) will never use typing; that is both due to them being concrete and final, and since
 		 * actual serializers and deserializers will also ignore any attempts to enforce typing.
 		 */
+		@Override
 		public boolean useForType(JavaType javaType) {
 
 			if (javaType.isJavaLangObject()) {
diff --git a/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java b/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java
index 1071f6ee52..8159347b89 100644
--- a/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/GenericToStringSerializer.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.
@@ -92,6 +92,7 @@ public byte[] serialize(@Nullable T value) {
 	}
 
 	@Override
+	@Nullable
 	public T deserialize(@Nullable byte[] bytes) {
 
 		if (bytes == null) {
diff --git a/src/main/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializer.java
index 76238bc60d..32d626bdd8 100644
--- a/src/main/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializer.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.
@@ -158,6 +158,7 @@ public byte[] serialize(@Nullable T value) throws SerializationException {
 		}
 	}
 
+	@Nullable
 	@Override
 	@SuppressWarnings("unchecked")
 	public T deserialize(@Nullable byte[] bytes) throws SerializationException {
diff --git a/src/main/java/org/springframework/data/redis/serializer/JacksonObjectReader.java b/src/main/java/org/springframework/data/redis/serializer/JacksonObjectReader.java
index 4e76cd4ba7..e2c1d943ec 100644
--- a/src/main/java/org/springframework/data/redis/serializer/JacksonObjectReader.java
+++ b/src/main/java/org/springframework/data/redis/serializer/JacksonObjectReader.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/serializer/JacksonObjectWriter.java b/src/main/java/org/springframework/data/redis/serializer/JacksonObjectWriter.java
index b7383697f7..88db313130 100644
--- a/src/main/java/org/springframework/data/redis/serializer/JacksonObjectWriter.java
+++ b/src/main/java/org/springframework/data/redis/serializer/JacksonObjectWriter.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/serializer/JdkSerializationRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java
index 00c79c6f8a..db67928a94 100644
--- a/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.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.
@@ -20,8 +20,8 @@
 import org.springframework.core.serializer.DefaultSerializer;
 import org.springframework.core.serializer.support.DeserializingConverter;
 import org.springframework.core.serializer.support.SerializingConverter;
-import org.springframework.data.redis.util.RedisAssertions;
 import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
 
 /**
  * Java Serialization {@link RedisSerializer}.
@@ -77,10 +77,14 @@ public JdkSerializationRedisSerializer(@Nullable ClassLoader classLoader) {
 	public JdkSerializationRedisSerializer(Converter serializer,
 			Converter deserializer) {
 
-		this.serializer = RedisAssertions.requireNonNull(serializer, "Serializer must not be null");
-		this.deserializer = RedisAssertions.requireNonNull(deserializer, "Deserializer must not be null");
+		Assert.notNull(serializer, "Serializer must not be null");
+		Assert.notNull(deserializer, "Deserializer must not be null");
+
+		this.serializer = serializer;
+		this.deserializer = deserializer;
 	}
 
+	@Nullable
 	@Override
 	public byte[] serialize(@Nullable Object value) {
 
@@ -95,6 +99,7 @@ public byte[] serialize(@Nullable Object value) {
 		}
 	}
 
+	@Nullable
 	@Override
 	public Object deserialize(@Nullable byte[] bytes) {
 
diff --git a/src/main/java/org/springframework/data/redis/serializer/OxmSerializer.java b/src/main/java/org/springframework/data/redis/serializer/OxmSerializer.java
index fb1eb4da5e..18ceace01f 100644
--- a/src/main/java/org/springframework/data/redis/serializer/OxmSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/OxmSerializer.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.
@@ -102,6 +102,7 @@ public byte[] serialize(@Nullable Object value) throws SerializationException {
 		return stream.toByteArray();
 	}
 
+	@Nullable
 	@Override
 	public Object deserialize(@Nullable byte[] bytes) throws SerializationException {
 
diff --git a/src/main/java/org/springframework/data/redis/serializer/RedisElementReader.java b/src/main/java/org/springframework/data/redis/serializer/RedisElementReader.java
index 445bebf45a..fb2c37dac4 100644
--- a/src/main/java/org/springframework/data/redis/serializer/RedisElementReader.java
+++ b/src/main/java/org/springframework/data/redis/serializer/RedisElementReader.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/serializer/RedisElementWriter.java b/src/main/java/org/springframework/data/redis/serializer/RedisElementWriter.java
index fe30afbe50..c67f2b0fa8 100644
--- a/src/main/java/org/springframework/data/redis/serializer/RedisElementWriter.java
+++ b/src/main/java/org/springframework/data/redis/serializer/RedisElementWriter.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/serializer/RedisSerializationContext.java b/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java
index f3157b3407..42f9c75639 100644
--- a/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java
+++ b/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.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/serializer/RedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/RedisSerializer.java
index 648a69dcd7..5141c5e388 100644
--- a/src/main/java/org/springframework/data/redis/serializer/RedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/RedisSerializer.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/serializer/RedisSerializerToSerializationPairAdapter.java b/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java
index 03ca10377d..fc436d8dd5 100644
--- a/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java
+++ b/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.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/serializer/SerializationException.java b/src/main/java/org/springframework/data/redis/serializer/SerializationException.java
index 3f03667ff1..1493dd6ef1 100644
--- a/src/main/java/org/springframework/data/redis/serializer/SerializationException.java
+++ b/src/main/java/org/springframework/data/redis/serializer/SerializationException.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/serializer/SerializationUtils.java b/src/main/java/org/springframework/data/redis/serializer/SerializationUtils.java
index bd2de9dffc..ee78179598 100644
--- a/src/main/java/org/springframework/data/redis/serializer/SerializationUtils.java
+++ b/src/main/java/org/springframework/data/redis/serializer/SerializationUtils.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/serializer/StringRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java
index 8af0002f46..b9fea3cb27 100644
--- a/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/StringRedisSerializer.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.
@@ -80,11 +80,13 @@ public StringRedisSerializer(Charset charset) {
 		this.charset = charset;
 	}
 
+	@Nullable
 	@Override
 	public byte[] serialize(@Nullable String value) {
 		return (value == null ? null : value.getBytes(charset));
 	}
 
+	@Nullable
 	@Override
 	public String deserialize(@Nullable byte[] bytes) {
 		return (bytes == null ? null : new String(bytes, charset));
diff --git a/src/main/java/org/springframework/data/redis/stream/Cancelable.java b/src/main/java/org/springframework/data/redis/stream/Cancelable.java
index b7e3cd6369..c1b89a831b 100644
--- a/src/main/java/org/springframework/data/redis/stream/Cancelable.java
+++ b/src/main/java/org/springframework/data/redis/stream/Cancelable.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/stream/DefaultStreamMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/stream/DefaultStreamMessageListenerContainer.java
index 25cd0d4b13..03c7d6add8 100644
--- a/src/main/java/org/springframework/data/redis/stream/DefaultStreamMessageListenerContainer.java
+++ b/src/main/java/org/springframework/data/redis/stream/DefaultStreamMessageListenerContainer.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.
@@ -224,9 +224,7 @@ private Function> getReadFunction(StreamReadRequest
 		byte[] rawKey = ((RedisSerializer) template.getKeySerializer())
 				.serialize(streamRequest.getStreamOffset().getKey());
 
-		if (streamRequest instanceof StreamMessageListenerContainer.ConsumerStreamReadRequest) {
-
-			ConsumerStreamReadRequest consumerStreamRequest = (ConsumerStreamReadRequest) streamRequest;
+		if (streamRequest instanceof ConsumerStreamReadRequest consumerStreamRequest) {
 
 			StreamReadOptions readOptions = consumerStreamRequest.isAutoAcknowledge() ? this.readOptions.autoAcknowledge()
 					: this.readOptions;
diff --git a/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java b/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java
index 02af99b523..9d9349e18b 100644
--- a/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java
+++ b/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.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.
@@ -105,7 +105,7 @@ class DefaultStreamReceiver> implements StreamReceiver
 	public Flux receive(StreamOffset streamOffset) {
 
 		if (logger.isDebugEnabled()) {
-			logger.debug(String.format("receive(%s)", streamOffset));
+			logger.debug("receive(%s)".formatted(streamOffset));
 		}
 
 		RedisSerializationContext.SerializationPair keySerializer = template.getSerializationContext()
@@ -125,11 +125,10 @@ public Flux receive(StreamOffset streamOffset) {
 	}
 
 	@Override
-	@SuppressWarnings("unchecked")
 	public Flux receiveAutoAck(Consumer consumer, StreamOffset streamOffset) {
 
 		if (logger.isDebugEnabled()) {
-			logger.debug(String.format("receiveAutoAck(%s, %s)", consumer, streamOffset));
+			logger.debug("receiveAutoAck(%s, %s)".formatted(consumer, streamOffset));
 		}
 
 		Function> readFunction = getConsumeReadFunction(streamOffset.getKey(), consumer,
@@ -146,11 +145,10 @@ public Flux receiveAutoAck(Consumer consumer, StreamOffset streamOffset) {
 	}
 
 	@Override
-	@SuppressWarnings("unchecked")
 	public Flux receive(Consumer consumer, StreamOffset streamOffset) {
 
 		if (logger.isDebugEnabled()) {
-			logger.debug(String.format("receive(%s, %s)", consumer, streamOffset));
+			logger.debug("receive(%s, %s)".formatted(consumer, streamOffset));
 		}
 
 		Function> readFunction = getConsumeReadFunction(streamOffset.getKey(), consumer,
@@ -229,7 +227,7 @@ void arm() {
 			sink.onRequest(toAdd -> {
 
 				if (logger.isDebugEnabled()) {
-					logger.debug(String.format("[stream: %s] onRequest(%d)", key, toAdd));
+					logger.debug("[stream: %s] onRequest(%d)".formatted(key, toAdd));
 				}
 
 				if (pollState.isSubscriptionActive()) {
@@ -251,7 +249,7 @@ void arm() {
 					}
 				} else {
 					if (logger.isDebugEnabled()) {
-						logger.debug(String.format("[stream: %s] onRequest(%d): Dropping, subscription canceled", key, toAdd));
+						logger.debug("[stream: %s] onRequest(%d): Dropping, subscription canceled".formatted(key, toAdd));
 					}
 				}
 			});
@@ -263,25 +261,25 @@ void arm() {
 		private void scheduleIfRequired() {
 
 			if (logger.isDebugEnabled()) {
-				logger.debug(String.format("[stream: %s] scheduleIfRequired()", key));
+				logger.debug("[stream: %s] scheduleIfRequired()".formatted(key));
 			}
 			if (pollState.isScheduled()) {
 				if (logger.isDebugEnabled()) {
-					logger.debug(String.format("[stream: %s] scheduleIfRequired(): Already scheduled", key));
+					logger.debug("[stream: %s] scheduleIfRequired(): Already scheduled".formatted(key));
 				}
 				return;
 			}
 
 			if (!pollState.isSubscriptionActive()) {
 				if (logger.isDebugEnabled()) {
-					logger.debug(String.format("[stream: %s] scheduleIfRequired(): Subscription cancelled", key));
+					logger.debug("[stream: %s] scheduleIfRequired(): Subscription cancelled".formatted(key));
 				}
 				return;
 			}
 
 			if (pollState.getRequested() > 0 && !overflow.isEmpty()) {
 				if (logger.isDebugEnabled()) {
-					logger.info(String.format("[stream: %s] scheduleIfRequired(): Requested: %d Emit from buffer", key,
+					logger.info("[stream: %s] scheduleIfRequired(): Requested: %d Emit from buffer".formatted(key,
 							pollState.getRequested()));
 				}
 				emitBuffer();
@@ -290,8 +288,8 @@ private void scheduleIfRequired() {
 			if (pollState.getRequested() == 0) {
 
 				if (logger.isDebugEnabled()) {
-					logger.debug(String
-							.format("[stream: %s] scheduleIfRequired(): Subscriber has no demand; Suspending subscription", key));
+					logger.debug(
+							"[stream: %s] scheduleIfRequired(): Subscriber has no demand; Suspending subscription".formatted(key));
 				}
 				return;
 			}
@@ -303,14 +301,14 @@ private void scheduleIfRequired() {
 			if (pollState.activateSchedule()) {
 
 				if (logger.isDebugEnabled()) {
-					logger.debug(String.format("[stream: %s] scheduleIfRequired(): Activating subscription", key));
+					logger.debug("[stream: %s] scheduleIfRequired(): Activating subscription".formatted(key));
 				}
 
 				ReadOffset readOffset = pollState.getCurrentReadOffset();
 
 				if (logger.isDebugEnabled()) {
 					logger.debug(
-							String.format("[stream: %s] scheduleIfRequired(): Activating subscription, offset %s", key, readOffset));
+							"[stream: %s] scheduleIfRequired(): Activating subscription, offset %s".formatted(key, readOffset));
 				}
 
 				Flux poll = readFunction.apply(readOffset)
@@ -319,7 +317,7 @@ private void scheduleIfRequired() {
 				poll.map(it -> {
 
 					if (logger.isDebugEnabled()) {
-						logger.debug(String.format("[stream: %s] onStreamMessage(%s)", key, it));
+						logger.debug("[stream: %s] onStreamMessage(%s)".formatted(key, it));
 					}
 
 					pollState.updateReadOffset(it.getId().getValue());
@@ -357,7 +355,7 @@ public void onError(Throwable t) {
 				public void onComplete() {
 
 					if (logger.isDebugEnabled()) {
-						logger.debug(String.format("[stream: %s] onComplete()", key));
+						logger.debug("[stream: %s] onComplete()".formatted(key));
 					}
 
 					pollState.scheduleCompleted();
@@ -381,20 +379,20 @@ private void onStreamMessage(V message) {
 				if (requested == Long.MAX_VALUE) {
 
 					if (logger.isDebugEnabled()) {
-						logger.debug(String.format("[stream: %s] onStreamMessage(%s): Emitting item, fast-path", key, message));
+						logger.debug("[stream: %s] onStreamMessage(%s): Emitting item, fast-path".formatted(key, message));
 					}
 					sink.next(message);
 				} else {
 
 					if (pollState.decrementRequested()) {
 						if (logger.isDebugEnabled()) {
-							logger.debug(String.format("[stream: %s] onStreamMessage(%s): Emitting item, slow-path", key, message));
+							logger.debug("[stream: %s] onStreamMessage(%s): Emitting item, slow-path".formatted(key, message));
 						}
 						sink.next(message);
 					} else {
 
 						if (logger.isDebugEnabled()) {
-							logger.debug(String.format("[stream: %s] onStreamMessage(%s): Buffering overflow", key, message));
+							logger.debug("[stream: %s] onStreamMessage(%s): Buffering overflow".formatted(key, message));
 						}
 						overflow.offer(message);
 					}
@@ -403,7 +401,7 @@ private void onStreamMessage(V message) {
 			} else {
 
 				if (logger.isDebugEnabled()) {
-					logger.debug(String.format("[stream: %s] onStreamMessage(%s): Buffering overflow", key, message));
+					logger.debug("[stream: %s] onStreamMessage(%s): Buffering overflow".formatted(key, message));
 				}
 				overflow.offer(message);
 			}
@@ -412,7 +410,7 @@ private void onStreamMessage(V message) {
 		private void onStreamError(Throwable t) {
 
 			if (logger.isDebugEnabled()) {
-				logger.debug(String.format("[stream: %s] onStreamError(%s)", key, t));
+				logger.debug("[stream: %s] onStreamError(%s)".formatted(key, t));
 			}
 
 			pollState.cancel();
@@ -435,14 +433,13 @@ private void emitBuffer() {
 
 					if (message == null) {
 						if (logger.isDebugEnabled()) {
-							logger.debug(String.format("[stream: %s] emitBuffer(): emission missed", key));
+							logger.debug("[stream: %s] emitBuffer(): emission missed".formatted(key));
 						}
 						break;
 					}
 
 					if (logger.isDebugEnabled()) {
-						logger.debug(
-								String.format("[stream: %s] emitBuffer(%s): Emitting item from buffer, fast-path", key, message));
+						logger.debug("[stream: %s] emitBuffer(%s): Emitting item from buffer, fast-path".formatted(key, message));
 					}
 
 					sink.next(message);
@@ -454,15 +451,14 @@ private void emitBuffer() {
 					if (message == null) {
 
 						if (logger.isDebugEnabled()) {
-							logger.debug(String.format("[stream: %s] emitBuffer(): emission missed", key));
+							logger.debug("[stream: %s] emitBuffer(): emission missed".formatted(key));
 						}
 						pollState.incrementRequested();
 						break;
 					}
 
 					if (logger.isDebugEnabled()) {
-						logger.debug(
-								String.format("[stream: %s] emitBuffer(%s): Emitting item from buffer, slow-path", key, message));
+						logger.debug("[stream: %s] emitBuffer(%s): Emitting item from buffer, slow-path".formatted(key, message));
 					}
 
 					sink.next(message);
diff --git a/src/main/java/org/springframework/data/redis/stream/ReadOffsetStrategy.java b/src/main/java/org/springframework/data/redis/stream/ReadOffsetStrategy.java
index 45cb9e8cac..2f2cc9561d 100644
--- a/src/main/java/org/springframework/data/redis/stream/ReadOffsetStrategy.java
+++ b/src/main/java/org/springframework/data/redis/stream/ReadOffsetStrategy.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/stream/StreamListener.java b/src/main/java/org/springframework/data/redis/stream/StreamListener.java
index 0c370c47a9..4122a2d625 100644
--- a/src/main/java/org/springframework/data/redis/stream/StreamListener.java
+++ b/src/main/java/org/springframework/data/redis/stream/StreamListener.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/stream/StreamMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java
index ff06716ac6..851a1f6d66 100644
--- a/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java
+++ b/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.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.
@@ -106,6 +106,7 @@
  * @author Mark Paluch
  * @author Christoph Strobl
  * @author Christian Rest
+ * @author DongCheol Kim
  * @param  Stream key and Stream field type.
  * @param  Stream value type.
  * @since 2.2
@@ -155,9 +156,10 @@ static StreamMessageListenerContainer>
 	}
 
 	/**
-	 * Register a new subscription for a Redis Stream. If the {@link StreamMessageListenerContainer#isRunning() is already
-	 * running} the {@link Subscription} will be added and run immediately, otherwise it'll be scheduled and started once
-	 * the container is actually {@link StreamMessageListenerContainer#start() started}.
+	 * Register a new subscription for a Redis Stream. If the container is already
+	 * {@link StreamMessageListenerContainer#isRunning() running} the {@link Subscription} will be added and started
+	 * immediately, otherwise it'll be scheduled and started once the container is actually
+	 * {@link StreamMessageListenerContainer#start() started}.
 	 * 

* Errors during {@link Record} retrieval lead to {@link Subscription#cancel() cancellation} of the underlying task. *

@@ -174,9 +176,10 @@ default Subscription receive(StreamOffset streamOffset, StreamListener } /** - * Register a new subscription for a Redis Stream. If the {@link StreamMessageListenerContainer#isRunning() is already - * running} the {@link Subscription} will be added and run immediately, otherwise it'll be scheduled and started once - * the container is actually {@link StreamMessageListenerContainer#start() started}. + * Register a new subscription for a Redis Stream. If the container is already + * {@link StreamMessageListenerContainer#isRunning() running} the {@link Subscription} will be added and started + * immediately, otherwise it'll be scheduled and started once the container is actually + * {@link StreamMessageListenerContainer#start() started}. *

* Every message must be acknowledged using * {@link org.springframework.data.redis.core.StreamOperations#acknowledge(Object, String, String...)} after @@ -200,9 +203,10 @@ default Subscription receive(Consumer consumer, StreamOffset streamOffset, St } /** - * Register a new subscription for a Redis Stream. If the {@link StreamMessageListenerContainer#isRunning() is already - * running} the {@link Subscription} will be added and run immediately, otherwise it'll be scheduled and started once - * the container is actually {@link StreamMessageListenerContainer#start() started}. + * Register a new subscription for a Redis Stream. If the container is already + * {@link StreamMessageListenerContainer#isRunning() running} the {@link Subscription} will be added and started + * immediately, otherwise it'll be scheduled and started once the container is actually + * {@link StreamMessageListenerContainer#start() started}. *

* Every message is acknowledged when received. *

@@ -223,9 +227,10 @@ default Subscription receiveAutoAck(Consumer consumer, StreamOffset streamOff } /** - * Register a new subscription for a Redis Stream. If the {@link StreamMessageListenerContainer#isRunning() is already - * running} the {@link Subscription} will be added and run immediately, otherwise it'll be scheduled and started once - * the container is actually {@link StreamMessageListenerContainer#start() started}. + * Register a new subscription for a Redis Stream. If the container is already + * {@link StreamMessageListenerContainer#isRunning() running} the {@link Subscription} will be added and started + * immediately, otherwise it'll be scheduled and started once the container is actually + * {@link StreamMessageListenerContainer#start() started}. *

* Errors during {@link Record} are tested against test {@link StreamReadRequest#getCancelSubscriptionOnError() * cancellation predicate} whether to cancel the underlying task. @@ -245,9 +250,9 @@ default Subscription receiveAutoAck(Consumer consumer, StreamOffset streamOff /** * Unregister a given {@link Subscription} from the container. This prevents the {@link Subscription} to be restarted - * in a potential {@link SmartLifecycle#stop() stop}/{@link SmartLifecycle#start() start} scenario.
- * An {@link Subscription#isActive() active} {@link Subscription subcription} is {@link Subscription#cancel() - * cancelled} prior to removal. + * in a potential {@link SmartLifecycle#stop() stop}/{@link SmartLifecycle#start() start} scenario. An + * {@link Subscription#isActive() active} {@link Subscription subcription} is {@link Subscription#cancel() cancelled} + * prior to removal. * * @param subscription must not be {@literal null}. */ diff --git a/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java b/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java index 6641a791c3..916c276478 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamPollTask.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/stream/StreamReceiver.java b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java index 3bb2f22af2..89cccd0ad8 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.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/stream/Subscription.java b/src/main/java/org/springframework/data/redis/stream/Subscription.java index d10005c25d..01db41a52f 100644 --- a/src/main/java/org/springframework/data/redis/stream/Subscription.java +++ b/src/main/java/org/springframework/data/redis/stream/Subscription.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/stream/Task.java b/src/main/java/org/springframework/data/redis/stream/Task.java index 97cf04117a..9371161ef9 100644 --- a/src/main/java/org/springframework/data/redis/stream/Task.java +++ b/src/main/java/org/springframework/data/redis/stream/Task.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/support/atomic/CompareAndSet.java b/src/main/java/org/springframework/data/redis/support/atomic/CompareAndSet.java index b361fb7714..d5682c626b 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/CompareAndSet.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/CompareAndSet.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/support/atomic/RedisAtomicDouble.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java index 3cef647aa9..a60d55ad3c 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.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. @@ -15,6 +15,7 @@ */ package org.springframework.data.redis.support.atomic; +import java.io.Serial; import java.io.Serializable; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -46,6 +47,7 @@ */ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyOperations { + @Serial private static final long serialVersionUID = 1L; private volatile String key; @@ -158,11 +160,12 @@ private void initializeIfAbsent() { public double get() { Double value = operations.get(key); + if (value != null) { return value; } - throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist", key)); + throw new DataRetrievalFailureException("The key '%s' seems to no longer exist".formatted(key)); } /** diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java index dc4289f1d2..ffdb6ff50d 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.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. @@ -15,6 +15,7 @@ */ package org.springframework.data.redis.support.atomic; +import java.io.Serial; import java.io.Serializable; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -47,6 +48,7 @@ */ public class RedisAtomicInteger extends Number implements Serializable, BoundKeyOperations { + @Serial private static final long serialVersionUID = 1L; private volatile String key; @@ -158,11 +160,12 @@ private void initializeIfAbsent() { public int get() { Integer value = operations.get(key); + if (value != null) { return value; } - throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist", key)); + throw new DataRetrievalFailureException("The key '%s' seems to no longer exist".formatted(key)); } /** diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java index 9e92b0d873..df7f96035d 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.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. @@ -15,6 +15,7 @@ */ package org.springframework.data.redis.support.atomic; +import java.io.Serial; import java.io.Serializable; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -48,6 +49,7 @@ */ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOperations { + @Serial private static final long serialVersionUID = 1L; private volatile String key; @@ -159,11 +161,12 @@ private void initializeIfAbsent() { public long get() { Long value = operations.get(key); + if (value != null) { return value; } - throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist", key)); + throw new DataRetrievalFailureException("The key '%s' seems to no longer exist".formatted(key)); } /** diff --git a/src/main/java/org/springframework/data/redis/support/collections/AbstractRedisCollection.java b/src/main/java/org/springframework/data/redis/support/collections/AbstractRedisCollection.java index d8a2af95a9..6c6f14d23d 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/AbstractRedisCollection.java +++ b/src/main/java/org/springframework/data/redis/support/collections/AbstractRedisCollection.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. @@ -131,13 +131,6 @@ public void rename(final String newKey) { key = newKey; } - protected void checkResult(@Nullable Object obj) { - - if (obj == null) { - throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode"); - } - } - @Override public boolean equals(@Nullable Object o) { @@ -166,13 +159,13 @@ public int hashCode() { @Override public String toString() { + return "%s for key: %s".formatted(getClass().getSimpleName(), getKey()); + } - StringBuilder sb = new StringBuilder(); - - sb.append(String.format("%s for key:", getClass().getSimpleName())); - sb.append(getKey()); + protected void checkResult(@Nullable Object obj) { - return sb.toString(); + if (obj == null) { + throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode"); + } } - } diff --git a/src/main/java/org/springframework/data/redis/support/collections/CollectionUtils.java b/src/main/java/org/springframework/data/redis/support/collections/CollectionUtils.java index e5b901a022..867d1ca3be 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/CollectionUtils.java +++ b/src/main/java/org/springframework/data/redis/support/collections/CollectionUtils.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/support/collections/DefaultRedisList.java b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java index fd2da300cf..dba9341ba4 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java +++ b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.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. @@ -41,6 +41,7 @@ * @author Christoph Strobl * @author Mark Paluch * @author John Blum + * @author Jinbeom Kim */ public class DefaultRedisList extends AbstractRedisCollection implements RedisList { @@ -216,16 +217,14 @@ public boolean remove(Object o) { public void add(int index, E element) { if (index == 0) { - listOps.leftPush(element); - cap(); + addFirst(element); return; } int size = size(); if (index == size()) { - listOps.rightPush(element); - cap(); + addLast(element); return; } @@ -241,24 +240,15 @@ public boolean addAll(int index, Collection collection) { // insert collection in reverse if (index == 0) { - - Collection reverseCollection = CollectionUtils.reverse(collection); - - for (E element : reverseCollection) { - listOps.leftPush(element); - cap(); - } - + CollectionUtils.reverse(collection) + .forEach(this::addFirst); return true; } int size = size(); if (index == size()) { - for (E element : collection) { - listOps.rightPush(element); - cap(); - } + collection.forEach(this::addLast); return true; } @@ -341,9 +331,7 @@ public E element() { @Override public boolean offer(E element) { - listOps.rightPush(element); - cap(); - return true; + return add(element); } @Override diff --git a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisMap.java b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisMap.java index d5cb4659ed..9dd0274783 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisMap.java +++ b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisMap.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. @@ -187,7 +187,6 @@ public int hashCode() { @Override public String toString() { - return "RedisStore for key:" + getKey(); } @@ -317,17 +316,17 @@ public DataType getType() { return hashOps.getType(); } + @Override + public Cursor> scan() { + return scan(ScanOptions.NONE); + } + private void checkResult(@Nullable Object obj) { if (obj == null) { throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode"); } } - @Override - public Cursor> scan() { - return scan(ScanOptions.NONE); - } - /** * @since 1.4 * @param options diff --git a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisSet.java b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisSet.java index a1370d97a4..385124f185 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisSet.java +++ b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisSet.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/support/collections/DefaultRedisZSet.java b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisZSet.java index d6ea8ee0a5..8d1b5aed25 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisZSet.java +++ b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisZSet.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/support/collections/RedisCollection.java b/src/main/java/org/springframework/data/redis/support/collections/RedisCollection.java index 5bcf57199e..1dd7195619 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisCollection.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisCollection.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/support/collections/RedisCollectionFactoryBean.java b/src/main/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBean.java index a8e6228e41..b6fc3e35d2 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBean.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBean.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/support/collections/RedisIterator.java b/src/main/java/org/springframework/data/redis/support/collections/RedisIterator.java index afa0624606..10a43ef176 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisIterator.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisIterator.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/support/collections/RedisList.java b/src/main/java/org/springframework/data/redis/support/collections/RedisList.java index a55f1f7a03..02fb6b55ab 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisList.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisList.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/support/collections/RedisMap.java b/src/main/java/org/springframework/data/redis/support/collections/RedisMap.java index 650114cf1d..a2eb3b8985 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisMap.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisMap.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/support/collections/RedisProperties.java b/src/main/java/org/springframework/data/redis/support/collections/RedisProperties.java index 61644f9787..d02d86b6fc 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisProperties.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisProperties.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/support/collections/RedisSet.java b/src/main/java/org/springframework/data/redis/support/collections/RedisSet.java index 60f0b0c3d1..50e0592300 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisSet.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisSet.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/support/collections/RedisStore.java b/src/main/java/org/springframework/data/redis/support/collections/RedisStore.java index b931b3f014..81677ab094 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisStore.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisStore.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/support/collections/RedisZSet.java b/src/main/java/org/springframework/data/redis/support/collections/RedisZSet.java index a0a8f5657d..63a96de44e 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisZSet.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisZSet.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/support/collections/ReversedRedisListView.java b/src/main/java/org/springframework/data/redis/support/collections/ReversedRedisListView.java index 8451a80dde..89dd3da3f0 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/ReversedRedisListView.java +++ b/src/main/java/org/springframework/data/redis/support/collections/ReversedRedisListView.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. @@ -639,8 +639,9 @@ class DescendingListIterator implements ListIterator { DescendingListIterator(int size, int position) { if (position < 0 || position > size) { - String message = String.format("Position [%d] is out of bounds: [0, %d]", position, size); - throw new IndexOutOfBoundsException(message); + throw new IndexOutOfBoundsException( + ("Position [%d] is out of bounds;" + " position must be greater than equal to 0 and less than size %d") + .formatted(position, size)); } this.it = base.listIterator(size - position); diff --git a/src/main/java/org/springframework/data/redis/util/ByteUtils.java b/src/main/java/org/springframework/data/redis/util/ByteUtils.java index 93e4e76969..6ae97539ed 100644 --- a/src/main/java/org/springframework/data/redis/util/ByteUtils.java +++ b/src/main/java/org/springframework/data/redis/util/ByteUtils.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/util/RedisAssertions.java b/src/main/java/org/springframework/data/redis/util/RedisAssertions.java index 34e5bfede7..22da3c395d 100644 --- a/src/main/java/org/springframework/data/redis/util/RedisAssertions.java +++ b/src/main/java/org/springframework/data/redis/util/RedisAssertions.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. @@ -25,7 +25,9 @@ * * @author John Blum * @since 3.1.0 + * @deprecated since 3.3, will be removed in a future revision in favor of Spring's {@link Assert} utility. */ +@Deprecated(since = "3.3", forRemoval = true) public abstract class RedisAssertions { /** @@ -40,7 +42,7 @@ public abstract class RedisAssertions { * @see #requireNonNull(Object, Supplier) */ public static T requireNonNull(@Nullable T target, String message, Object... arguments) { - return requireNonNull(target, () -> String.format(message, arguments)); + return requireNonNull(target, () -> message.formatted(arguments)); } /** @@ -88,7 +90,7 @@ public static T requireNonNull(@Nullable T target, RuntimeExceptionSupplier * @see #requireNonNull(Object, Supplier) */ public static T requireState(@Nullable T target, String message, Object... arguments) { - return requireState(target, () -> String.format(message, arguments)); + return requireState(target, () -> message.formatted(arguments)); } /** diff --git a/src/main/kotlin/org/springframework/data/redis/core/PartialUpdateExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/PartialUpdateExtensions.kt index c36c8d7710..ced500d4f8 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/PartialUpdateExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/PartialUpdateExtensions.kt @@ -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/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensions.kt index 492af3d9a4..bba2924256 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensions.kt index fe26ed4d66..b7a1594921 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensions.kt index ebbf651325..6a4e38036a 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensions.kt index b58a93ebcd..ffd6fee07e 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensions.kt index 0878ae0a8b..4fef76f849 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensions.kt index bd1d4db2c4..8594699ec2 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensions.kt index 8bba7683c0..579b7fadd7 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensions.kt index 2bdda370d6..44a4a82922 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensions.kt index dcacae65de..e0679e2834 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensions.kt b/src/main/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensions.kt index de0ed8a657..e53512eb74 100644 --- a/src/main/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensions.kt +++ b/src/main/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensions.kt @@ -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/resources/notice.txt b/src/main/resources/notice.txt index b33d38469b..07867733df 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.3 GA (2024.0.0) +Spring Data Redis 3.3.12 (2024.0.12) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -42,6 +42,18 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + + + + + + + + + + + + diff --git a/src/test/java/org/springframework/data/redis/Address.java b/src/test/java/org/springframework/data/redis/Address.java index 8628d84ca3..f24a9c6d1d 100644 --- a/src/test/java/org/springframework/data/redis/Address.java +++ b/src/test/java/org/springframework/data/redis/Address.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/test/java/org/springframework/data/redis/ByteBufferObjectFactory.java b/src/test/java/org/springframework/data/redis/ByteBufferObjectFactory.java index b3d5315d29..1a6a249cca 100644 --- a/src/test/java/org/springframework/data/redis/ByteBufferObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/ByteBufferObjectFactory.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/test/java/org/springframework/data/redis/ConnectionFactoryTracker.java b/src/test/java/org/springframework/data/redis/ConnectionFactoryTracker.java index d619e6021c..2210c99ae7 100644 --- a/src/test/java/org/springframework/data/redis/ConnectionFactoryTracker.java +++ b/src/test/java/org/springframework/data/redis/ConnectionFactoryTracker.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/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.java b/src/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.java index 99d5ddea98..9cd21baef5 100644 --- a/src/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.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/test/java/org/springframework/data/redis/DoubleObjectFactory.java b/src/test/java/org/springframework/data/redis/DoubleObjectFactory.java index 2d2ab66c57..279437ea72 100644 --- a/src/test/java/org/springframework/data/redis/DoubleObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/DoubleObjectFactory.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/test/java/org/springframework/data/redis/LongAsStringObjectFactory.java b/src/test/java/org/springframework/data/redis/LongAsStringObjectFactory.java index 9ee9af93c8..fc183fafdf 100644 --- a/src/test/java/org/springframework/data/redis/LongAsStringObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/LongAsStringObjectFactory.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/test/java/org/springframework/data/redis/LongObjectFactory.java b/src/test/java/org/springframework/data/redis/LongObjectFactory.java index da538b0f6d..773fcad57b 100644 --- a/src/test/java/org/springframework/data/redis/LongObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/LongObjectFactory.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/test/java/org/springframework/data/redis/ObjectFactory.java b/src/test/java/org/springframework/data/redis/ObjectFactory.java index 3438d57ffa..44d0343b34 100644 --- a/src/test/java/org/springframework/data/redis/ObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/ObjectFactory.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/test/java/org/springframework/data/redis/Person.java b/src/test/java/org/springframework/data/redis/Person.java index 0201e14a59..610257d7a0 100644 --- a/src/test/java/org/springframework/data/redis/Person.java +++ b/src/test/java/org/springframework/data/redis/Person.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/test/java/org/springframework/data/redis/PersonObjectFactory.java b/src/test/java/org/springframework/data/redis/PersonObjectFactory.java index d429823a4c..8b5ccb1523 100644 --- a/src/test/java/org/springframework/data/redis/PersonObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/PersonObjectFactory.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/test/java/org/springframework/data/redis/PrefixStringObjectFactory.java b/src/test/java/org/springframework/data/redis/PrefixStringObjectFactory.java index d4b4b34525..c3c5da29c9 100644 --- a/src/test/java/org/springframework/data/redis/PrefixStringObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/PrefixStringObjectFactory.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/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.java b/src/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.java index 7eae9bdc85..733d742695 100644 --- a/src/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.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/test/java/org/springframework/data/redis/RawObjectFactory.java b/src/test/java/org/springframework/data/redis/RawObjectFactory.java index fd0148881f..9d1608f17b 100644 --- a/src/test/java/org/springframework/data/redis/RawObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/RawObjectFactory.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/test/java/org/springframework/data/redis/RedisViewPE.java b/src/test/java/org/springframework/data/redis/RedisViewPE.java index d4b7e25853..65f4ffbc6b 100644 --- a/src/test/java/org/springframework/data/redis/RedisViewPE.java +++ b/src/test/java/org/springframework/data/redis/RedisViewPE.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/test/java/org/springframework/data/redis/SettingsUtils.java b/src/test/java/org/springframework/data/redis/SettingsUtils.java index cadeca6ff7..19548d72a0 100644 --- a/src/test/java/org/springframework/data/redis/SettingsUtils.java +++ b/src/test/java/org/springframework/data/redis/SettingsUtils.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. @@ -18,6 +18,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Properties; import org.springframework.data.redis.connection.RedisClusterConfiguration; @@ -114,9 +115,11 @@ public static RedisStandaloneConfiguration standaloneConfiguration() { * @return a new {@link RedisSentinelConfiguration} initialized with test endpoint settings. */ public static RedisSentinelConfiguration sentinelConfiguration() { - return new RedisSentinelConfiguration(getSentinelMaster(), - new HashSet<>(Arrays.asList(String.format("%s:%d", getHost(), getSentinelPort()), - String.format("%s:%d", getHost(), getSentinelPort() + 1)))); + + List sentinelHostPorts = List.of("%s:%d".formatted(getHost(), getSentinelPort()), + "%s:%d".formatted(getHost(), getSentinelPort() + 1)); + + return new RedisSentinelConfiguration(getSentinelMaster(), new HashSet<>(sentinelHostPorts)); } /** @@ -125,8 +128,7 @@ public static RedisSentinelConfiguration sentinelConfiguration() { * @return a new {@link RedisClusterConfiguration} initialized with test endpoint settings. */ public static RedisClusterConfiguration clusterConfiguration() { - return new RedisClusterConfiguration( - Collections.singletonList(String.format("%s:%d", getHost(), getClusterPort()))); + return new RedisClusterConfiguration(List.of("%s:%d".formatted(getHost(), getClusterPort()))); } /** diff --git a/src/test/java/org/springframework/data/redis/StringObjectFactory.java b/src/test/java/org/springframework/data/redis/StringObjectFactory.java index 609d9405e9..37d0ae3e12 100644 --- a/src/test/java/org/springframework/data/redis/StringObjectFactory.java +++ b/src/test/java/org/springframework/data/redis/StringObjectFactory.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/test/java/org/springframework/data/redis/TestCondition.java b/src/test/java/org/springframework/data/redis/TestCondition.java index 3eceff67d4..6b17ea91b5 100644 --- a/src/test/java/org/springframework/data/redis/TestCondition.java +++ b/src/test/java/org/springframework/data/redis/TestCondition.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/test/java/org/springframework/data/redis/cache/CacheTestParams.java b/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java index 538a059d33..b037099902 100644 --- a/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java +++ b/src/test/java/org/springframework/data/redis/cache/CacheTestParams.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/test/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollectorUnitTests.java b/src/test/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollectorUnitTests.java index bdef135de1..ae6fcafab1 100644 --- a/src/test/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollectorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/DefaultCacheStatisticsCollectorUnitTests.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/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java index 233333ef83..fb5a56a1b6 100644 --- a/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.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/test/java/org/springframework/data/redis/cache/DefaultRedisCacheWriterTests.java b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCacheWriterTests.java index 1f07ea6110..f6fcfc9f64 100644 --- a/src/test/java/org/springframework/data/redis/cache/DefaultRedisCacheWriterTests.java +++ b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCacheWriterTests.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. @@ -33,6 +33,7 @@ import java.util.function.Consumer; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -427,6 +428,7 @@ void noOpStatisticsCollectorReturnsEmptyStatsInstance() { } @ParameterizedRedisTest // GH-1686 + @Disabled("Occasional failures on CI but not locally") void doLockShouldGetLock() throws InterruptedException { int threadCount = 3; diff --git a/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java b/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java index 9ef7231ae7..d718055ffa 100644 --- a/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java +++ b/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.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/test/java/org/springframework/data/redis/cache/MutableCacheStatisticsUnitTests.java b/src/test/java/org/springframework/data/redis/cache/MutableCacheStatisticsUnitTests.java index b80358ea9e..29c9e1002f 100644 --- a/src/test/java/org/springframework/data/redis/cache/MutableCacheStatisticsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/MutableCacheStatisticsUnitTests.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/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java index edbe99e964..94de42115d 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.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/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java index 699d07917d..e03714beb2 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.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/test/java/org/springframework/data/redis/cache/RedisCacheTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheTests.java index 6677ab7a9d..4602d4c6f0 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheTests.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/test/java/org/springframework/data/redis/cache/RedisCacheUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheUnitTests.java index 94fae0870f..b1b0ef311f 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheUnitTests.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/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java index e9d6ce75ff..ec8e69b52c 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.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/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java b/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java index c02fe6be4b..4334ce1028 100644 --- a/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.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/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java b/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java index 2c88f2a3b3..9ccac8b555 100644 --- a/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 the original author or authors. + * Copyright 2024-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/config/StubErrorHandler.java b/src/test/java/org/springframework/data/redis/config/StubErrorHandler.java index 2c43190c89..93b6ea9455 100644 --- a/src/test/java/org/springframework/data/redis/config/StubErrorHandler.java +++ b/src/test/java/org/springframework/data/redis/config/StubErrorHandler.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/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java index b6b9cd6ed4..4662437afe 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.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/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java index f30dc5f108..f1205d2848 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.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/test/java/org/springframework/data/redis/connection/AbstractConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionTransactionIntegrationTests.java index 1b5c4672f5..ded34d63b6 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionTransactionIntegrationTests.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/test/java/org/springframework/data/redis/connection/AbstractConnectionUnitTestBase.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionUnitTestBase.java index 050ffaee56..40c3b9fa88 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionUnitTestBase.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionUnitTestBase.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. @@ -55,8 +55,7 @@ private Class resolveReturnedClassFromGernericType() { private ParameterizedType resolveReturnedClassFromGernericType(Class clazz) { Object genericSuperclass = clazz.getGenericSuperclass(); - if (genericSuperclass instanceof ParameterizedType) { - ParameterizedType parameterizedType = (ParameterizedType) genericSuperclass; + if (genericSuperclass instanceof ParameterizedType parameterizedType) { Type rawtype = parameterizedType.getRawType(); if (AbstractConnectionUnitTestBase.class.equals(rawtype)) { return parameterizedType; diff --git a/src/test/java/org/springframework/data/redis/connection/AbstractTransactionalTestBase.java b/src/test/java/org/springframework/data/redis/connection/AbstractTransactionalTestBase.java index 1c63fbdd3e..f99df546be 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractTransactionalTestBase.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractTransactionalTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java index 693ef624bc..c7876e4092 100644 --- a/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/BitFieldSubCommandsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java b/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java index b3a6d5f33e..f57a2f5233 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/ClusterConnectionTests.java index 2d13df6131..ad64444cc1 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java b/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java index f48d44ce8d..fa2b4706b5 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.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. @@ -60,7 +60,7 @@ void localCalculationShouldMatchServers() { Long serverSlot = jedis.clusterKeySlot(key); assertThat(slot) - .as(String.format("Expected slot for key '%s' to be %s but server calculated %s.", key, slot, serverSlot)) + .describedAs("Expected slot for key '%s' to be %s but server calculated %s", key, slot, serverSlot) .isEqualTo(serverSlot.intValue()); } diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterTestVariables.java b/src/test/java/org/springframework/data/redis/connection/ClusterTestVariables.java index cb33e10de2..4be52a6363 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterTestVariables.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterTestVariables.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java index 74ad0677e9..40c28082e1 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.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/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java index 3f9f4a0cbb..e7a0e6c607 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.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/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTests.java index 9931ac330d..4efcf03168 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTests.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/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java index 5f7db6e388..3441a8f581 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.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/test/java/org/springframework/data/redis/connection/ReactiveStreamCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/ReactiveStreamCommandsUnitTests.java new file mode 100644 index 0000000000..dedaf0c84d --- /dev/null +++ b/src/test/java/org/springframework/data/redis/connection/ReactiveStreamCommandsUnitTests.java @@ -0,0 +1,56 @@ +/* + * Copyright 2024-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.data.redis.connection; + +import static org.assertj.core.api.Assertions.*; + +import java.nio.ByteBuffer; + +import org.junit.jupiter.api.Test; + +import org.springframework.data.domain.Range; +import org.springframework.data.redis.connection.ReactiveStreamCommands.PendingRecordsCommand; + +/** + * Unit tests for {@link ReactiveStreamCommands}. + * + * @author jinkshower + */ +class ReactiveStreamCommandsUnitTests { + + @Test // GH-2982 + void pendingRecordsCommandRangeShouldThrowExceptionWhenRangeIsNull() { + + ByteBuffer key = ByteBuffer.wrap("my-stream".getBytes()); + String groupName = "my-group"; + + PendingRecordsCommand command = PendingRecordsCommand.pending(key, groupName); + + assertThatIllegalArgumentException().isThrownBy(() -> command.range(null, 10L)); + } + + @Test // GH-2982 + void pendingRecordsCommandRangeShouldThrowExceptionWhenCountIsNegative() { + + ByteBuffer key = ByteBuffer.wrap("my-stream".getBytes()); + String groupName = "my-group"; + + PendingRecordsCommand command = PendingRecordsCommand.pending(key, groupName); + Range range = Range.closed("0", "10"); + + assertThatIllegalArgumentException().isThrownBy(() -> command.range(range, -1L)); + } +} diff --git a/src/test/java/org/springframework/data/redis/connection/RedisClusterConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisClusterConfigurationUnitTests.java index 6d969d0876..abcac7bab1 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisClusterConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisClusterConfigurationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java index 0345e8bfb5..034a06f38c 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.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/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java index 2a10866752..d66c7057ce 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java index d0940d99c6..8d64a7bbbf 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.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/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java index ac5c87748f..78f8c7df6b 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.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/test/java/org/springframework/data/redis/connection/RedisSentinelConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisSentinelConfigurationUnitTests.java index 2b38c0a751..4f9b242883 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisSentinelConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisSentinelConfigurationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/RedisServerUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisServerUnitTests.java index 215f56f374..f8ebab1183 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisServerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisServerUnitTests.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/test/java/org/springframework/data/redis/connection/RedisStreamCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisStreamCommandsUnitTests.java new file mode 100644 index 0000000000..74579d57a6 --- /dev/null +++ b/src/test/java/org/springframework/data/redis/connection/RedisStreamCommandsUnitTests.java @@ -0,0 +1,49 @@ +/* + * Copyright 2024-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.data.redis.connection; + +import static org.assertj.core.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import org.springframework.data.domain.Range; +import org.springframework.data.redis.connection.RedisStreamCommands.XPendingOptions; + +/** + * Unit tests for {@link RedisStreamCommands}. + * + * @author jinkshower + */ +class RedisStreamCommandsUnitTests { + + @Test // GH-2982 + void xPendingOptionsUnboundedShouldThrowExceptionWhenCountIsNegative() { + assertThatIllegalArgumentException().isThrownBy(() -> XPendingOptions.unbounded(-1L)); + } + + @Test // GH-2982 + void xPendingOptionsRangeShouldThrowExceptionWhenRangeIsNull() { + assertThatIllegalArgumentException().isThrownBy(() -> XPendingOptions.range(null, 10L)); + } + + @Test // GH-2982 + void xPendingOptionsRangeShouldThrowExceptionWhenCountIsNegative() { + + Range range = Range.closed("0", "10"); + + assertThatIllegalArgumentException().isThrownBy(() -> XPendingOptions.range(range, -1L)); + } +} diff --git a/src/test/java/org/springframework/data/redis/connection/RedisZSetCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisZSetCommandsUnitTests.java index 28774e5156..9ebf89e6ea 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisZSetCommandsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisZSetCommandsUnitTests.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/test/java/org/springframework/data/redis/connection/ReturnTypeUnitTests.java b/src/test/java/org/springframework/data/redis/connection/ReturnTypeUnitTests.java index 4c51047f9a..a455115c34 100644 --- a/src/test/java/org/springframework/data/redis/connection/ReturnTypeUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ReturnTypeUnitTests.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/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java index d1073dc31b..02ab8faf5a 100644 --- a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.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/test/java/org/springframework/data/redis/connection/WeightsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/WeightsUnitTests.java index beabaad473..adc1b8e7bd 100644 --- a/src/test/java/org/springframework/data/redis/connection/WeightsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/WeightsUnitTests.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/test/java/org/springframework/data/redis/connection/convert/ConvertersUnitTests.java b/src/test/java/org/springframework/data/redis/connection/convert/ConvertersUnitTests.java index 74d3f7df8d..6c7c248558 100644 --- a/src/test/java/org/springframework/data/redis/connection/convert/ConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/convert/ConvertersUnitTests.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. @@ -18,18 +18,18 @@ import static org.assertj.core.api.Assertions.*; import java.util.Iterator; -import java.util.regex.Matcher; import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; + import org.springframework.data.redis.connection.RedisClusterNode; import org.springframework.data.redis.connection.RedisClusterNode.Flag; import org.springframework.data.redis.connection.RedisClusterNode.LinkState; import org.springframework.data.redis.connection.RedisNode.NodeType; -import org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter; +import org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter.AddressPortHostname; /** * Unit tests for {@link Converters}. @@ -37,6 +37,7 @@ * @author Christoph Strobl * @author Mark Paluch * @author Sorokin Evgeniy + * @author Marcin Grzejszczak */ class ConvertersUnitTests { @@ -72,6 +73,10 @@ class ConvertersUnitTests { private static final String CLUSTER_NODE_WITH_SINGLE_INVALID_IPV6_HOST = "67adfe3df1058896e3cb49d2863e0f70e7e159fa 2a02:6b8:c67:9c:0:6d8b:33da:5a2c: master,nofailover - 0 1692108412315 1 connected 0-5460"; + private static final String CLUSTER_NODE_WITH_SINGLE_IPV4_EMPTY_HOSTNAME = "3765733728631672640db35fd2f04743c03119c6 10.180.0.33:11003@16379, master - 0 1708041426947 2 connected 0-5460"; + + private static final String CLUSTER_NODE_WITH_SINGLE_IPV4_HOSTNAME = "3765733728631672640db35fd2f04743c03119c6 10.180.0.33:11003@16379,hostname1 master - 0 1708041426947 2 connected 0-5460"; + @Test // DATAREDIS-315 void toSetOfRedis30ClusterNodesShouldConvertSingleStringNodesResponseCorrectly() { @@ -248,6 +253,37 @@ void toClusterNodeWithIPv6Hostname() { assertThat(node.getSlotRange().getSlots().size()).isEqualTo(5461); } + @Test // GH-2862 + void toClusterNodeWithIPv4EmptyHostname() { + + RedisClusterNode node = Converters.toClusterNode(CLUSTER_NODE_WITH_SINGLE_IPV4_EMPTY_HOSTNAME); + + assertThat(node.getId()).isEqualTo("3765733728631672640db35fd2f04743c03119c6"); + assertThat(node.getHost()).isEqualTo("10.180.0.33"); + assertThat(node.hasValidHost()).isTrue(); + assertThat(node.getPort()).isEqualTo(11003); + assertThat(node.getType()).isEqualTo(NodeType.MASTER); + assertThat(node.getFlags()).contains(Flag.MASTER); + assertThat(node.getLinkState()).isEqualTo(LinkState.CONNECTED); + assertThat(node.getSlotRange().getSlots().size()).isEqualTo(5461); + } + + @Test // GH-2862 + void toClusterNodeWithIPv4Hostname() { + + RedisClusterNode node = Converters.toClusterNode(CLUSTER_NODE_WITH_SINGLE_IPV4_HOSTNAME); + + assertThat(node.getId()).isEqualTo("3765733728631672640db35fd2f04743c03119c6"); + assertThat(node.getHost()).isEqualTo("10.180.0.33"); + assertThat(node.getName()).isEqualTo("hostname1"); + assertThat(node.hasValidHost()).isTrue(); + assertThat(node.getPort()).isEqualTo(11003); + assertThat(node.getType()).isEqualTo(NodeType.MASTER); + assertThat(node.getFlags()).contains(Flag.MASTER); + assertThat(node.getLinkState()).isEqualTo(LinkState.CONNECTED); + assertThat(node.getSlotRange().getSlots().size()).isEqualTo(5461); + } + @Test // GH-2678 void toClusterNodeWithIPv6HostnameSquareBrackets() { @@ -271,35 +307,64 @@ void toClusterNodeWithInvalidIPv6Hostname() { @ParameterizedTest // GH-2678 @MethodSource("clusterNodesEndpoints") - void shouldAcceptHostPatterns(String endpoint, String expectedAddress, String expectedPort, String expectedHostname) { + void shouldAcceptHostPatterns(String endpoint, AddressPortHostname expected) { - Matcher matcher = ClusterNodesConverter.clusterEndpointPattern.matcher(endpoint); - assertThat(matcher.matches()).isTrue(); + AddressPortHostname addressPortHostname = AddressPortHostname.parse(endpoint); - assertThat(matcher.group(1)).isEqualTo(expectedAddress); - assertThat(matcher.group(2)).isEqualTo(expectedPort); - assertThat(matcher.group(3)).isEqualTo(expectedHostname); + assertThat(addressPortHostname).isEqualTo(expected); } static Stream clusterNodesEndpoints() { - return Stream.of( + Stream regular = Stream.of( // IPv4 with Host, Redis 3 - Arguments.of("1.2.4.4:7379", "1.2.4.4", "7379", null), + Arguments.of("1.2.4.4:7379", new AddressPortHostname("1.2.4.4", "7379", null)), // IPv6 with Host, Redis 3 - Arguments.of("6b8:c67:9c:0:6d8b:33da:5a2c:6380", "6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null), + Arguments.of("6b8:c67:9c:0:6d8b:33da:5a2c:6380", + new AddressPortHostname("6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null)), // Assuming IPv6 in brackets with Host, Redis 3 - Arguments.of("[6b8:c67:9c:0:6d8b:33da:5a2c]:6380", "6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null), + Arguments.of("[6b8:c67:9c:0:6d8b:33da:5a2c]:6380", + new AddressPortHostname("6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null)), // IPv4 with Host and Bus Port, Redis 4 - Arguments.of("127.0.0.1:7382@17382", "127.0.0.1", "7382", null), + Arguments.of("127.0.0.1:7382@17382", new AddressPortHostname("127.0.0.1", "7382", null)), // IPv6 with Host and Bus Port, Redis 4 - Arguments.of("6b8:c67:9c:0:6d8b:33da:5a2c:6380", "6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null), + Arguments.of("6b8:c67:9c:0:6d8b:33da:5a2c:6380", + new AddressPortHostname("6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null)), // Hostname with Port and Bus Port, Redis 7 - Arguments.of("my.host-name.com:7379@17379", "my.host-name.com", "7379", null), + Arguments.of("my.host-name.com:7379@17379", new AddressPortHostname("my.host-name.com", "7379", null)), // With hostname, Redis 7 - Arguments.of("1.2.4.4:7379@17379,my.host-name.com", "1.2.4.4", "7379", "my.host-name.com")); + Arguments.of("1.2.4.4:7379@17379,my.host-name.com", + new AddressPortHostname("1.2.4.4", "7379", "my.host-name.com"))); + + Stream weird = Stream.of( + // Port-only + Arguments.of(":6380", new AddressPortHostname("", "6380", null)), + + // Port-only with bus-port + Arguments.of(":6380@6381", new AddressPortHostname("", "6380", null)), + // IP with trailing comma + Arguments.of("127.0.0.1:6380,", new AddressPortHostname("127.0.0.1", "6380", null)), + // IPv6 with bus-port + Arguments.of("2a02:6b8:c67:9c:0:6d8b:33da:5a2c:6380@6381", + new AddressPortHostname("2a02:6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null)), + // IPv6 with bus-port and hostname + Arguments.of("2a02:6b8:c67:9c:0:6d8b:33da:5a2c:6380@6381,hostname1", + new AddressPortHostname("2a02:6b8:c67:9c:0:6d8b:33da:5a2c", "6380", "hostname1")), + // Port-only with hostname + Arguments.of(":6380,hostname1", new AddressPortHostname("", "6380", "hostname1")), + + // Port-only with bus-port + Arguments.of(":6380@6381,hostname1", new AddressPortHostname("", "6380", "hostname1")), + // IPv6 in brackets with bus-port + Arguments.of("[2a02:6b8:c67:9c:0:6d8b:33da:5a2c]:6380@6381", + new AddressPortHostname("2a02:6b8:c67:9c:0:6d8b:33da:5a2c", "6380", null)), + // IPv6 in brackets with bus-port and hostname + Arguments.of("[2a02:6b8:c67:9c:0:6d8b:33da:5a2c]:6380@6381,hostname1", + new AddressPortHostname("2a02:6b8:c67:9c:0:6d8b:33da:5a2c", "6380", "hostname1"))); + + return Stream.concat(regular, weird); } } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisAclIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisAclIntegrationTests.java index 38dd34c0b2..ade77dd515 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisAclIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisAclIntegrationTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisClientConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClientConfigurationUnitTests.java index ccb41b5ff9..74203c8bc1 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisClientConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClientConfigurationUnitTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java index 0ebc8ea86d..6fe6eb43c1 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.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. @@ -43,6 +43,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; + import org.springframework.dao.DataAccessException; import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Range.Bound; @@ -53,6 +54,7 @@ import org.springframework.data.redis.connection.BitFieldSubCommands; import org.springframework.data.redis.connection.ClusterConnectionTests; import org.springframework.data.redis.connection.ClusterSlotHashUtil; +import org.springframework.data.redis.connection.ClusterTopology; import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.connection.DefaultSortParameters; import org.springframework.data.redis.connection.Limit; @@ -75,6 +77,7 @@ import org.springframework.data.redis.test.condition.EnabledOnRedisClusterAvailable; import org.springframework.data.redis.test.extension.JedisExtension; import org.springframework.data.redis.test.util.HexStringUtils; +import org.springframework.test.util.ReflectionTestUtils; /** * @author Christoph Strobl @@ -2950,4 +2953,20 @@ void lPosNonExisting() { assertThat(result).isEmpty(); } + + @Test // GH-2986 + void shouldUseCachedTopology() { + + JedisClusterConnection.JedisClusterTopologyProvider provider = (JedisClusterConnection.JedisClusterTopologyProvider) clusterConnection + .getTopologyProvider(); + ReflectionTestUtils.setField(provider, "cached", null); + + ClusterTopology topology = provider.getTopology(); + assertThat(topology).isInstanceOf(JedisClusterConnection.JedisClusterTopology.class); + + assertThat(provider.shouldUseCachedValue(null)).isFalse(); + assertThat(provider.shouldUseCachedValue(new JedisClusterConnection.JedisClusterTopology(Set.of(), System.currentTimeMillis() - 101, 100))).isFalse(); + assertThat(provider.shouldUseCachedValue( + new JedisClusterConnection.JedisClusterTopology(Set.of(), System.currentTimeMillis() + 100, 100))).isTrue(); + } } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java index 7a341018a7..161561415e 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactorySentinelIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactorySentinelIntegrationTests.java index 1a3a3d6bd1..6a75f265b1 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactorySentinelIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactorySentinelIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryUnitTests.java index f6e3f3f9e4..d068557d8c 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java index 21446b5644..b4aae693c2 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.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. @@ -404,8 +404,8 @@ void pExpireShouldSupportExiprationForValuesLargerThanInteger() { long ttl = connection.pTtl("pexpireKey"); assertThat(millis - ttl < 20L) - .as(String.format("difference between millis=%s and ttl=%s should not be greater than 20ms but is %s", millis, - ttl, millis - ttl)) + .describedAs("difference between millis=%s and ttl=%s should not be greater than 20ms but is %s", + millis, ttl, millis - ttl) .isTrue(); } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java index a5cacfb2df..7577aa85ea 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java index 45706608a2..fc8f91f01e 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java index 4a9150d4de..348576b710 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java index 21c1b8e41d..5a869da105 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverterUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverterUnitTests.java index b83593891b..92019da91e 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverterUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnectionUnitTests.java index e7ec289152..1289e7f6dd 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelIntegrationTests.java index cd036204ae..06150da2d4 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSentinelIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSubscriptionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSubscriptionUnitTests.java index 262c185d59..34b249fe79 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisSubscriptionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisSubscriptionUnitTests.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/test/java/org/springframework/data/redis/connection/jedis/JedisTransactionalConnectionStarvationTest.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisTransactionalConnectionStarvationTest.java index fb4e4057fe..0e2d2e9061 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisTransactionalConnectionStarvationTest.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisTransactionalConnectionStarvationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/ScanTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/ScanTests.java index 269cf395a5..c89882bd49 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/ScanTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/ScanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/TransactionalJedisIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/TransactionalJedisIntegrationTests.java index e5c79be848..437976e41b 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/TransactionalJedisIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/TransactionalJedisIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/extension/JedisConnectionFactoryExtension.java b/src/test/java/org/springframework/data/redis/connection/jedis/extension/JedisConnectionFactoryExtension.java index 07b59cd38a..267e5cb37b 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/extension/JedisConnectionFactoryExtension.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/extension/JedisConnectionFactoryExtension.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceAclIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceAclIntegrationTests.java index f16a64f6e5..3d165c856f 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceAclIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceAclIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfigurationUnitTests.java index 35c818bb81..607e7346d6 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfigurationUnitTests.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. @@ -37,12 +37,11 @@ */ class LettuceClientConfigurationUnitTests { - @Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667, DATAREDIS-918 + @Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667, DATAREDIS-918, GH-2945 void shouldCreateEmptyConfiguration() { LettuceClientConfiguration configuration = LettuceClientConfiguration.defaultConfiguration(); - assertThat(configuration.isUseSsl()).isFalse(); assertThat(configuration.isVerifyPeer()).isTrue(); assertThat(configuration.isStartTls()).isFalse(); @@ -55,7 +54,7 @@ void shouldCreateEmptyConfiguration() { assertThat(configuration.getClientName()).isEmpty(); assertThat(configuration.getCommandTimeout()).isEqualTo(Duration.ofSeconds(60)); assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofMillis(100)); - assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofMillis(100)); + assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO); } @Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667 @@ -88,13 +87,13 @@ void shouldConfigureAllProperties() { } @Test // DATAREDIS-881 - void shutdownQuietPeriodShouldDefaultToTimeout() { + void shutdownQuietPeriodShouldDefaultInitialValue() { LettuceClientConfiguration configuration = LettuceClientConfiguration.builder() .shutdownTimeout(Duration.ofSeconds(42)).build(); assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofSeconds(42)); - assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofSeconds(42)); + assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO); } @Test // DATAREDIS-576 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java index 5ecba15478..b1fe07dae6 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionUnitTests.java index 25fd46d783..7d2a1003bf 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyspaceNotificationsTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyspaceNotificationsTests.java index d347283a8b..137423dd57 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyspaceNotificationsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyspaceNotificationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceCommandArgsComparator.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceCommandArgsComparator.java index 94cacb157f..c3d3997514 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceCommandArgsComparator.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceCommandArgsComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the original author or authors. + * Copyright 2021-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java index 3c91253f23..0c2d1d65e2 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.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. @@ -402,7 +402,7 @@ void connectsThroughRedisSocket() { @Test // DATAREDIS-762, DATAREDIS-869 void factoryUsesElastiCacheMasterReplicaConnections() { - assumeTrue(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()), + assumeTrue("No replicas connected to %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getPort()), connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0); LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.REPLICA) @@ -429,7 +429,7 @@ void factoryUsesElastiCacheMasterReplicaConnections() { @Test // DATAREDIS-1093 void pubSubDoesNotSupportMasterReplicaConnections() { - assumeTrue(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()), + assumeTrue("No replicas connected to %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getPort()), connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0); RedisStaticMasterReplicaConfiguration elastiCache = new RedisStaticMasterReplicaConfiguration( @@ -451,7 +451,7 @@ void pubSubDoesNotSupportMasterReplicaConnections() { @Test // DATAREDIS-762, DATAREDIS-869 void factoryUsesElastiCacheMasterWithoutMaster() { - assumeTrue(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()), + assumeTrue("No replicas connected to %s:%d.".formatted(SettingsUtils.getHost(), SettingsUtils.getPort()), connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0); LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.MASTER) @@ -481,7 +481,7 @@ void factoryUsesElastiCacheMasterWithoutMaster() { @Test // DATAREDIS-580, DATAREDIS-869 void factoryUsesMasterReplicaConnections() { - assumeTrue(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()), + assumeTrue("No replicas connected to %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getPort()), connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0); LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE) @@ -489,6 +489,7 @@ void factoryUsesMasterReplicaConnections() { LettuceConnectionFactory factory = new LettuceConnectionFactory(SettingsUtils.standaloneConfiguration(), configuration); + factory.start(); RedisConnection connection = factory.getConnection(); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryUnitTests.java index b4dd713fbe..52cf60355c 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java index 7ca1190049..afe2108296 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineFlushOnEndIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineFlushOnEndIntegrationTests.java index 1e4133d154..c810a396a1 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineFlushOnEndIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineFlushOnEndIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java index c9e702d2c0..9793364915 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxFlushOnEndIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxFlushOnEndIntegrationTests.java index e5e49d6a8b..fa4004078a 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxFlushOnEndIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxFlushOnEndIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java index 0ad92314da..2d965cbfdf 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java index 0b6f1653ef..f5e153c8dc 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java index 0a6c19a166..0ba0123eac 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,33 @@ */ package org.springframework.data.redis.connection.lettuce; -import static org.assertj.core.api.Assertions.*; -import static org.mockito.Mockito.*; - -import io.lettuce.core.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyMap; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + +import io.lettuce.core.KeyScanCursor; +import io.lettuce.core.MapScanCursor; +import io.lettuce.core.RedisClient; +import io.lettuce.core.RedisFuture; +import io.lettuce.core.ScanArgs; +import io.lettuce.core.ScanCursor; +import io.lettuce.core.ScoredValue; +import io.lettuce.core.ScoredValueScanCursor; +import io.lettuce.core.ValueScanCursor; +import io.lettuce.core.XAddArgs; +import io.lettuce.core.XClaimArgs; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.async.RedisAsyncCommands; +import io.lettuce.core.api.sync.RedisCommands; import io.lettuce.core.codec.ByteArrayCodec; import io.lettuce.core.codec.RedisCodec; import io.lettuce.core.codec.StringCodec; @@ -41,6 +62,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -59,40 +81,44 @@ * @author Christoph Strobl * @author Mark Paluch */ -public class LettuceConnectionUnitTests { +class LettuceConnectionUnitTests { - @SuppressWarnings("rawtypes") - public static class BasicUnitTests extends AbstractConnectionUnitTestBase { + protected LettuceConnection connection; + private RedisClient clientMock; + StatefulRedisConnection statefulConnectionMock; + RedisAsyncCommands asyncCommandsMock; + RedisCommands commandsMock; - protected LettuceConnection connection; - private RedisClient clientMock; - StatefulRedisConnection statefulConnectionMock; - RedisAsyncCommands asyncCommandsMock; + @BeforeEach + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void setUp() throws InvocationTargetException, IllegalAccessException { - @SuppressWarnings({ "unchecked" }) - @BeforeEach - public void setUp() throws InvocationTargetException, IllegalAccessException { + clientMock = mock(RedisClient.class); + statefulConnectionMock = mock(StatefulRedisConnection.class); + when(clientMock.connect((RedisCodec) any())).thenReturn(statefulConnectionMock); - clientMock = mock(RedisClient.class); - statefulConnectionMock = mock(StatefulRedisConnection.class); - when(clientMock.connect((RedisCodec) any())).thenReturn(statefulConnectionMock); + asyncCommandsMock = Mockito.mock(RedisAsyncCommands.class, invocation -> { - asyncCommandsMock = Mockito.mock(RedisAsyncCommands.class, invocation -> { + if (invocation.getMethod().getReturnType().equals(RedisFuture.class)) { - if (invocation.getMethod().getReturnType().equals(RedisFuture.class)) { + Command cmd = new Command<>(CommandType.PING, new StatusOutput<>(StringCodec.UTF8)); + AsyncCommand async = new AsyncCommand<>(cmd); + async.complete(); - Command cmd = new Command<>(CommandType.PING, new StatusOutput<>(StringCodec.UTF8)); - AsyncCommand async = new AsyncCommand<>(cmd); - async.complete(); + return async; + } + return null; + }); + commandsMock = Mockito.mock(RedisCommands.class); - return async; - } - return null; - }); + when(statefulConnectionMock.async()).thenReturn(asyncCommandsMock); + when(statefulConnectionMock.sync()).thenReturn(commandsMock); + connection = new LettuceConnection(0, clientMock); + } - when(statefulConnectionMock.async()).thenReturn(asyncCommandsMock); - connection = new LettuceConnection(0, clientMock); - } + @Nested + @SuppressWarnings({ "rawtypes", "deprecation" }) + class BasicUnitTests extends AbstractConnectionUnitTestBase { @Test // DATAREDIS-184 public void shutdownWithNullOptionsIsCalledCorrectly() { @@ -155,7 +181,7 @@ void shouldThrowExceptionWhenAccessingRedisSentinelsCommandsWhenNoSentinelsConfi .isThrownBy(() -> connection.getSentinelConnection()); } - @Test // DATAREDIS-431 + @Test // DATAREDIS-431, GH-2984 void dbIndexShouldBeSetWhenObtainingConnection() { connection = new LettuceConnection(null, 0, clientMock, 0); @@ -163,6 +189,7 @@ void dbIndexShouldBeSetWhenObtainingConnection() { connection.getNativeConnection(); verify(asyncCommandsMock).dispatch(eq(CommandType.SELECT), any(), any()); + verifyNoInteractions(commandsMock); } @Test // DATAREDIS-603 @@ -173,8 +200,7 @@ void translatesUnknownExceptions() { when(asyncCommandsMock.set(any(), any())).thenThrow(exception); connection = new LettuceConnection(null, 0, clientMock, 1); - assertThatThrownBy(() -> connection.set("foo".getBytes(), "bar".getBytes())) - .hasRootCause(exception); + assertThatThrownBy(() -> connection.set("foo".getBytes(), "bar".getBytes())).hasRootCause(exception); } @Test // DATAREDIS-603 @@ -265,8 +291,8 @@ public List getKeys() { sc.setCursor(cursorId); sc.setFinished(false); - Command> command = new Command<>(new LettuceConnection.CustomCommandType("SCAN"), - new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + Command> command = new Command<>( + new LettuceConnection.CustomCommandType("SCAN"), new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { @Override protected void setOutput(ByteBuffer bytes) { @@ -275,10 +301,10 @@ protected void setOutput(ByteBuffer bytes) { AsyncCommand> future = new AsyncCommand<>(command); future.complete(); - when(asyncCommandsMock.scan(any(ScanCursor.class),any(ScanArgs.class))).thenReturn(future, future); + when(asyncCommandsMock.scan(any(ScanCursor.class), any(ScanArgs.class))).thenReturn(future, future); Cursor cursor = connection.scan(KeyScanOptions.NONE); - cursor.next(); //initial + cursor.next(); // initial assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); cursor.next(); // fetch next @@ -300,8 +326,8 @@ public List getValues() { sc.setCursor(cursorId); sc.setFinished(false); - Command> command = new Command<>(new LettuceConnection.CustomCommandType("SSCAN"), - new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + Command> command = new Command<>( + new LettuceConnection.CustomCommandType("SSCAN"), new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { @Override protected void setOutput(ByteBuffer bytes) { @@ -310,10 +336,11 @@ protected void setOutput(ByteBuffer bytes) { AsyncCommand> future = new AsyncCommand<>(command); future.complete(); - when(asyncCommandsMock.sscan(any(byte[].class), any(ScanCursor.class),any(ScanArgs.class))).thenReturn(future, future); + when(asyncCommandsMock.sscan(any(byte[].class), any(ScanCursor.class), any(ScanArgs.class))).thenReturn(future, + future); Cursor cursor = connection.setCommands().sScan("key".getBytes(), KeyScanOptions.NONE); - cursor.next(); //initial + cursor.next(); // initial assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); cursor.next(); // fetch next @@ -335,8 +362,8 @@ public List> getValues() { sc.setCursor(cursorId); sc.setFinished(false); - Command> command = new Command<>(new LettuceConnection.CustomCommandType("ZSCAN"), - new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + Command> command = new Command<>( + new LettuceConnection.CustomCommandType("ZSCAN"), new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { @Override protected void setOutput(ByteBuffer bytes) { @@ -345,10 +372,11 @@ protected void setOutput(ByteBuffer bytes) { AsyncCommand> future = new AsyncCommand<>(command); future.complete(); - when(asyncCommandsMock.zscan(any(byte[].class), any(ScanCursor.class),any(ScanArgs.class))).thenReturn(future, future); + when(asyncCommandsMock.zscan(any(byte[].class), any(ScanCursor.class), any(ScanArgs.class))).thenReturn(future, + future); Cursor cursor = connection.zSetCommands().zScan("key".getBytes(), KeyScanOptions.NONE); - cursor.next(); //initial + cursor.next(); // initial assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); cursor.next(); // fetch next @@ -370,8 +398,8 @@ public Map getMap() { sc.setCursor(cursorId); sc.setFinished(false); - Command> command = new Command<>(new LettuceConnection.CustomCommandType("HSCAN"), - new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + Command> command = new Command<>( + new LettuceConnection.CustomCommandType("HSCAN"), new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { @Override protected void setOutput(ByteBuffer bytes) { @@ -380,10 +408,11 @@ protected void setOutput(ByteBuffer bytes) { AsyncCommand> future = new AsyncCommand<>(command); future.complete(); - when(asyncCommandsMock.hscan(any(byte[].class), any(ScanCursor.class),any(ScanArgs.class))).thenReturn(future, future); + when(asyncCommandsMock.hscan(any(byte[].class), any(ScanCursor.class), any(ScanArgs.class))).thenReturn(future, + future); Cursor> cursor = connection.hashCommands().hScan("key".getBytes(), KeyScanOptions.NONE); - cursor.next(); //initial + cursor.next(); // initial assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); cursor.next(); // fetch next @@ -394,13 +423,12 @@ protected void setOutput(ByteBuffer bytes) { } - public static class LettucePipelineConnectionUnitTests extends BasicUnitTests { + @Nested + class LettucePipelineConnectionUnitTests extends BasicUnitTests { - @Override @BeforeEach public void setUp() throws InvocationTargetException, IllegalAccessException { - super.setUp(); - this.connection.openPipeline(); + connection.openPipeline(); } @Test // DATAREDIS-528 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java index 0e4c15fffb..74cb969dc6 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfigurationUnitTests.java index 85215098ff..4616935df9 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfigurationUnitTests.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. @@ -38,7 +38,7 @@ */ class LettucePoolingClientConfigurationUnitTests { - @Test // DATAREDIS-667, DATAREDIS-918 + @Test // DATAREDIS-667, DATAREDIS-918, GH-2945 void shouldCreateEmptyConfiguration() { LettucePoolingClientConfiguration configuration = LettucePoolingClientConfiguration.defaultConfiguration(); @@ -55,7 +55,7 @@ void shouldCreateEmptyConfiguration() { assertThat(configuration.getClientResources()).isEmpty(); assertThat(configuration.getCommandTimeout()).isEqualTo(Duration.ofSeconds(60)); assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofMillis(100)); - assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofMillis(100)); + assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO); } @Test // DATAREDIS-667 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProviderUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProviderUnitTests.java index ebd84f545e..bc18a584cc 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProviderUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProviderUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterCommandsIntegrationTests.java index 5c439889b6..d069de8231 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java index 3d94e4a394..70c1932b3e 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommandsIntegrationTests.java index 4d08c1402d..aa7c7fee12 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommandsIntegrationTests.java index 6632a1f97c..f2afb32b4e 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommandsIntegrationTests.java index 197a2b53a1..bb692e97fe 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommandsIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommandsIntegrationTests.java index 13848ee84c..1f56137cf2 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterTestSupport.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterTestSupport.java index d253e49cf9..3e900e339f 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterTestSupport.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterTestSupport.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. @@ -52,12 +52,12 @@ public void tearDown() { if (nativeCommands != null) { nativeCommands.flushall(); - if (nativeCommands instanceof RedisCommands) { - ((RedisCommands) nativeCommands).getStatefulConnection().close(); + if (nativeCommands instanceof RedisCommands redisCommands) { + redisCommands.getStatefulConnection().close(); } - if (nativeCommands instanceof RedisAdvancedClusterCommands) { - ((RedisAdvancedClusterCommands) nativeCommands).getStatefulConnection().close(); + if (nativeCommands instanceof RedisAdvancedClusterCommands redisAdvancedClusterCommands) { + redisAdvancedClusterCommands.getStatefulConnection().close(); } } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommandsIntegrationTests.java index 0bedf8273f..17684f0dce 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java index d06df9f15b..3407fea953 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.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. @@ -155,16 +155,16 @@ public String toString() { public void close() throws IOException { try { - if (connectionProvider instanceof DisposableBean) { - ((DisposableBean) connectionProvider).destroy(); + if (connectionProvider instanceof DisposableBean disposableBean) { + disposableBean.destroy(); } - if (nativeConnectionProvider instanceof DisposableBean) { - ((DisposableBean) nativeConnectionProvider).destroy(); + if (nativeConnectionProvider instanceof DisposableBean disposableBean) { + disposableBean.destroy(); } - if (nativeBinaryConnectionProvider instanceof DisposableBean) { - ((DisposableBean) nativeBinaryConnectionProvider).destroy(); + if (nativeBinaryConnectionProvider instanceof DisposableBean disposableBean) { + disposableBean.destroy(); } } catch (Exception ex) { throw new RuntimeException(ex); @@ -198,21 +198,21 @@ public void tearDown() { if (nativeCommands != null) { flushAll(); - if (nativeCommands instanceof RedisCommands) { - nativeConnectionProvider.release(((RedisCommands) nativeCommands).getStatefulConnection()); + if (nativeCommands instanceof RedisCommands redisCommands) { + nativeConnectionProvider.release((redisCommands).getStatefulConnection()); } - if (nativeCommands instanceof RedisAdvancedClusterCommands) { - nativeConnectionProvider.release(((RedisAdvancedClusterCommands) nativeCommands).getStatefulConnection()); + if (nativeCommands instanceof RedisAdvancedClusterCommands redisAdvancedClusterCommands) { + nativeConnectionProvider.release((redisAdvancedClusterCommands).getStatefulConnection()); } - if (nativeBinaryCommands instanceof RedisCommands) { - nativeBinaryConnectionProvider.release(((RedisCommands) nativeBinaryCommands).getStatefulConnection()); + if (nativeBinaryCommands instanceof RedisCommands redisCommands) { + nativeBinaryConnectionProvider.release((redisCommands).getStatefulConnection()); } - if (nativeBinaryCommands instanceof RedisAdvancedClusterCommands) { + if (nativeBinaryCommands instanceof RedisAdvancedClusterCommands redisAdvancedClusterCommands) { nativeBinaryConnectionProvider - .release(((RedisAdvancedClusterCommands) nativeBinaryCommands).getStatefulConnection()); + .release((redisAdvancedClusterCommands).getStatefulConnection()); } } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java index f01cd12658..5f3d43e2b8 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java index e152cf6311..973e061f90 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java index cdd9e99d8c..2b33e87a38 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommandsIntegrationTests.java index 457c009a60..3376c2727f 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java index 856466cfc0..b09aa7fe5c 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommandsIntegrationTests.java index cf072ff594..0b80066cfc 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommandsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommandsUnitTests.java index c4013494ce..17d976e7ac 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommandsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommandsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java index 4c4b6b7f7e..af050574b9 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnectionUnitTests.java index e8fe23e141..7e56c13cdb 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnectionUnitTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommandsIntegrationTests.java index 75a0b75a3a..17114f4405 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommandsIntegrationTests.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. @@ -111,7 +111,7 @@ void evalShaShouldFail() { @ParameterizedRedisTest // DATAREDIS-683 void evalShouldReturnStatus() { - ByteBuffer script = wrap(String.format("return redis.call('set','%s','ghk')", SAME_SLOT_KEY_1)); + ByteBuffer script = wrap("return redis.call('set','%s','ghk')".formatted(SAME_SLOT_KEY_1)); connection.scriptingCommands().eval(script, ReturnType.STATUS, 1, SAME_SLOT_KEY_1_BBUFFER.duplicate()) .as(StepVerifier::create) // diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java index 09be137a6d..ce6a8ebefe 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommandsIntegrationIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommandsIntegrationIntegrationTests.java index 394cb5cba9..f8046aef2c 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommandsIntegrationIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommandsIntegrationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java index 9fb4d8401b..b181ef6a60 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java index 15548cfc22..af3e43e135 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscriptionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscriptionUnitTests.java index 9583d1f760..61f4daf71a 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscriptionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscriptionUnitTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java index 78b69f568d..1dac69219b 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnectionUnitTests.java index 3785f6fdcb..4dd4e31b5b 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java index 7c119c3d03..cb57462908 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSubscriptionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSubscriptionUnitTests.java index 4c1ba0f9ec..bec4c050cb 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSubscriptionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSubscriptionUnitTests.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/test/java/org/springframework/data/redis/connection/lettuce/LettuceTestClientConfiguration.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceTestClientConfiguration.java index 086ccf86b0..04c295000e 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceTestClientConfiguration.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceTestClientConfiguration.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/test/java/org/springframework/data/redis/connection/lettuce/PipeliningFlushPolicyUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/PipeliningFlushPolicyUnitTests.java index 00ab6acf52..1dedf516dd 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/PipeliningFlushPolicyUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/PipeliningFlushPolicyUnitTests.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/test/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProviderIntegrationTest.java b/src/test/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProviderIntegrationTest.java index c585c5d3ee..07f17de6aa 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProviderIntegrationTest.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProviderIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/TransactionalLettuceIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/TransactionalLettuceIntegrationTests.java index 9e5f14a6ce..c3a55b3539 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/TransactionalLettuceIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/TransactionalLettuceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/extension/LettuceConnectionFactoryExtension.java b/src/test/java/org/springframework/data/redis/connection/lettuce/extension/LettuceConnectionFactoryExtension.java index 791c6b312e..e646e12593 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/extension/LettuceConnectionFactoryExtension.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/extension/LettuceConnectionFactoryExtension.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/test/java/org/springframework/data/redis/connection/lettuce/observability/ReactiveIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/ReactiveIntegrationTests.java index cdbaf8661a..5c352df982 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/observability/ReactiveIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/ReactiveIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/observability/SynchronousIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/SynchronousIntegrationTests.java index 52bbd0b03f..5220a64fd4 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/observability/SynchronousIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/SynchronousIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/observability/TestConfig.java b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/TestConfig.java index af6c481cad..387f799302 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/observability/TestConfig.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/observability/TestConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/connection/stream/StreamReadOptionsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/stream/StreamReadOptionsUnitTests.java index 4ee7bc9dfb..78fa69b066 100644 --- a/src/test/java/org/springframework/data/redis/connection/stream/StreamReadOptionsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/stream/StreamReadOptionsUnitTests.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/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java b/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java index 4fdc618f8a..485b6b1414 100644 --- a/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java +++ b/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.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/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryRuntimeHintTests.java b/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryRuntimeHintTests.java index c7d763a449..ffd9e4f772 100644 --- a/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryRuntimeHintTests.java +++ b/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryRuntimeHintTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryUnitTests.java b/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryUnitTests.java index 5b98034fbd..86e53f174a 100644 --- a/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/BoundOperationsProxyFactoryUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ConnectionMockingRedisTemplate.java b/src/test/java/org/springframework/data/redis/core/ConnectionMockingRedisTemplate.java index af5f87b504..c156421f6a 100644 --- a/src/test/java/org/springframework/data/redis/core/ConnectionMockingRedisTemplate.java +++ b/src/test/java/org/springframework/data/redis/core/ConnectionMockingRedisTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the original author or authors. + * Copyright 2021-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java b/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java index c8b83d3a07..c0796cd83b 100644 --- a/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java b/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java index a228f7b589..fb0e9a5515 100644 --- a/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.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/test/java/org/springframework/data/redis/core/DefaultClusterOperationsUnitTests.java b/src/test/java/org/springframework/data/redis/core/DefaultClusterOperationsUnitTests.java index e2deedc846..643b01ffe6 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultClusterOperationsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultClusterOperationsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java index d299c8378f..0000db4885 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultHashOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultHashOperationsIntegrationTests.java index fe79d8d014..8a2b7065ad 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultHashOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultHashOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultHyperLogLogOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultHyperLogLogOperationsIntegrationTests.java index 3ac0a643d4..be31c3932e 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultHyperLogLogOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultHyperLogLogOperationsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultListOperationsIntegrationIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultListOperationsIntegrationIntegrationTests.java index 559551a4b0..7f01b6c3f1 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultListOperationsIntegrationIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultListOperationsIntegrationIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java index cd9411b4ef..795e1a16af 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveHashOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveHashOperationsIntegrationTests.java index d844370bfb..dd1e1287ef 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveHashOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveHashOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperationsIntegrationTests.java index a52d2e20d3..183704a76e 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java index 92fcd6d783..3c9c5bee16 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveSetOperationsIntegrationTests.java index 6ffeb10725..37b497f893 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveSetOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveStreamOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveStreamOperationsIntegrationTests.java index c6040d795c..111775d324 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveStreamOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveStreamOperationsIntegrationTests.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. @@ -80,12 +80,6 @@ public class DefaultReactiveStreamOperationsIntegrationTests { return ReactiveOperationsTestParams.testParams(); } - /** - * @param redisTemplate - * @param keyFactory - * @param valueFactory - * @param label parameterized test label, no further use besides that. - */ public DefaultReactiveStreamOperationsIntegrationTests(Fixture fixture) { this.serializer = fixture.getSerializer(); @@ -359,7 +353,6 @@ void pendingShouldReadMessageDetails() { assertThat(pending.get(0).getConsumerName()).isEqualTo("my-consumer"); assertThat(pending.get(0).getTotalDeliveryCount()).isOne(); }).verifyComplete(); - } @ParameterizedRedisTest // GH-2465 @@ -384,6 +377,5 @@ void claimShouldReadMessageDetails() { assertThat(claimed.getValue()).isEqualTo(content); assertThat(claimed.getId()).isEqualTo(messageId); }).verifyComplete(); - } } diff --git a/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java index b1f44caf21..7dfeb0266d 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java index 6512faaae8..d0e1afa11a 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java index d4bf27f48b..67e31a2163 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultStreamOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultStreamOperationsIntegrationTests.java index eb2cb33079..1308555d84 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultStreamOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultStreamOperationsIntegrationTests.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. @@ -35,7 +35,16 @@ import org.springframework.data.redis.connection.jedis.extension.JedisConnectionFactoryExtension; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.lettuce.extension.LettuceConnectionFactoryExtension; -import org.springframework.data.redis.connection.stream.*; +import org.springframework.data.redis.connection.stream.Consumer; +import org.springframework.data.redis.connection.stream.MapRecord; +import org.springframework.data.redis.connection.stream.ObjectRecord; +import org.springframework.data.redis.connection.stream.PendingMessages; +import org.springframework.data.redis.connection.stream.PendingMessagesSummary; +import org.springframework.data.redis.connection.stream.ReadOffset; +import org.springframework.data.redis.connection.stream.RecordId; +import org.springframework.data.redis.connection.stream.StreamOffset; +import org.springframework.data.redis.connection.stream.StreamReadOptions; +import org.springframework.data.redis.connection.stream.StreamRecords; import org.springframework.data.redis.test.condition.EnabledOnCommand; import org.springframework.data.redis.test.condition.EnabledOnRedisDriver; import org.springframework.data.redis.test.condition.EnabledOnRedisVersion; @@ -65,7 +74,7 @@ public class DefaultStreamOperationsIntegrationTests { private final StreamOperations streamOps; public DefaultStreamOperationsIntegrationTests(RedisTemplate redisTemplate, ObjectFactory keyFactory, - ObjectFactory objectFactory) { + ObjectFactory objectFactory) { this.redisTemplate = redisTemplate; this.connectionFactory = redisTemplate.getRequiredConnectionFactory(); @@ -81,7 +90,7 @@ public static Collection testParams() { params.addAll(AbstractOperationsTestParams .testParams(JedisConnectionFactoryExtension.getConnectionFactory(RedisStanalone.class))); - if(RedisDetector.isClusterAvailable()) { + if (RedisDetector.isClusterAvailable()) { params.addAll(AbstractOperationsTestParams .testParams(JedisConnectionFactoryExtension.getConnectionFactory(RedisCluster.class))); } @@ -89,7 +98,7 @@ public static Collection testParams() { params.addAll(AbstractOperationsTestParams .testParams(LettuceConnectionFactoryExtension.getConnectionFactory(RedisStanalone.class))); - if(RedisDetector.isClusterAvailable()) { + if (RedisDetector.isClusterAvailable()) { params.addAll(AbstractOperationsTestParams .testParams(LettuceConnectionFactoryExtension.getConnectionFactory(RedisCluster.class))); } @@ -305,7 +314,8 @@ void readShouldReadSimpleMessage() { RecordId messageId1 = streamOps.add(StreamRecords.objectBacked(value).withStreamKey(key)); streamOps.add(StreamRecords.objectBacked(value).withStreamKey(key)); - List> messages = streamOps.read((Class) value.getClass(), StreamOffset.create(key, ReadOffset.from("0-0"))); + List> messages = streamOps.read((Class) value.getClass(), + StreamOffset.create(key, ReadOffset.from("0-0"))); assertThat(messages).hasSize(2); @@ -384,8 +394,7 @@ void pendingShouldReadMessageSummary() { RecordId messageId = streamOps.add(key, Collections.singletonMap(hashKey, value)); streamOps.createGroup(key, ReadOffset.from("0-0"), "my-group"); - streamOps.read(Consumer.from("my-group", "my-consumer"), - StreamOffset.create(key, ReadOffset.lastConsumed())); + streamOps.read(Consumer.from("my-group", "my-consumer"), StreamOffset.create(key, ReadOffset.lastConsumed())); PendingMessagesSummary pending = streamOps.pending(key, "my-group"); @@ -403,8 +412,7 @@ void pendingShouldReadMessageDetails() { RecordId messageId = streamOps.add(key, Collections.singletonMap(hashKey, value)); streamOps.createGroup(key, ReadOffset.from("0-0"), "my-group"); - streamOps.read(Consumer.from("my-group", "my-consumer"), - StreamOffset.create(key, ReadOffset.lastConsumed())); + streamOps.read(Consumer.from("my-group", "my-consumer"), StreamOffset.create(key, ReadOffset.lastConsumed())); PendingMessages pending = streamOps.pending(key, "my-group", Range.unbounded(), 10L); diff --git a/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java b/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java index fa8beb2b52..f0ae042f65 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsIntegrationTests.java index e539412d5a..1d73298e8d 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultValueOperationsUnitTests.java b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsUnitTests.java index 1a84eb956d..373542bd50 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultValueOperationsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java index 853b0d698f..dcfd41feb4 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.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/test/java/org/springframework/data/redis/core/DefaultZSetOperationsUnitTests.java b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsUnitTests.java index 02462003c2..fdbb55b91e 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the original author or authors. + * Copyright 2021-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java b/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java index b1d41586a1..bf7a398c1e 100644 --- a/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/MultithreadedRedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/MultithreadedRedisTemplateIntegrationTests.java index 7981efec59..c0ad3a2893 100644 --- a/src/test/java/org/springframework/data/redis/core/MultithreadedRedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/MultithreadedRedisTemplateIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ReactiveOperationsTestParams.java b/src/test/java/org/springframework/data/redis/core/ReactiveOperationsTestParams.java index 8364be9311..77895e3bb2 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveOperationsTestParams.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveOperationsTestParams.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/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java index 37fabc7b30..bd8eb0b141 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.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/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateUnitTests.java b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateUnitTests.java index f27299b272..de6deaa4a0 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java index b41ee3dc4e..ea3ec41dd8 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.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/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java index d1f9f4d800..63f7616908 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.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/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java index 4a17444966..c2b5f55b01 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java index 92c4ab693e..e4d376de82 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java index 19854032ff..2364624d06 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.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/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java index 6ab8ab530b..4d28d2632b 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.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/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java index 1e23e01c6e..69dfa26930 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.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. @@ -823,7 +823,7 @@ private static void waitUntilKeyIsGone(RedisTemplate template, String while (template.hasKey(key)) { if (waitedMs > limitMs) { - throw new TimeoutException(String.format("Key '%s' after %d %s still present", key, timeout, timeUnit)); + throw new TimeoutException("Key '%s' after %d %s still present".formatted(key, timeout, timeUnit)); } Thread.sleep(sleepMs); diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterUnitTests.java index b992cb5fa4..5c2cdd4edd 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java index ab19b6522c..fb464d61a3 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/RedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/RedisTemplateIntegrationTests.java index bbc18c6f0e..de22a409c4 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisTemplateIntegrationTests.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/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java index 9b22293cf6..06bea63fdc 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/ScanCursorUnitTests.java b/src/test/java/org/springframework/data/redis/core/ScanCursorUnitTests.java index bcbecdea3a..c9d8863791 100644 --- a/src/test/java/org/springframework/data/redis/core/ScanCursorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ScanCursorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java b/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java index 7b87af8ff0..20ebdd5890 100644 --- a/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/SessionUnitTests.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/test/java/org/springframework/data/redis/core/TimeoutUtilsUnitTests.java b/src/test/java/org/springframework/data/redis/core/TimeoutUtilsUnitTests.java index 91ec24027f..ae35baad70 100644 --- a/src/test/java/org/springframework/data/redis/core/TimeoutUtilsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/TimeoutUtilsUnitTests.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/test/java/org/springframework/data/redis/core/convert/BinaryKeyspaceIdentifierUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/BinaryKeyspaceIdentifierUnitTests.java index 99723e9229..eddea1020d 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/BinaryKeyspaceIdentifierUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/BinaryKeyspaceIdentifierUnitTests.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/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java index d859bee0d1..58063cb23d 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java b/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java index 41ce475264..c9b5d00c66 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java +++ b/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapperUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapperUnitTests.java index fa5943e91c..a25465545d 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapperUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/DefaultRedisTypeMapperUnitTests.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. @@ -215,7 +215,7 @@ private void writesTypeToField(Bucket bucket, Class type, @Nullable Object va assertThat(bucket.keySet()).isEmpty(); } else { - byte[] expected = value instanceof Class ? ((Class) value).getName().getBytes() : value.toString().getBytes(); + byte[] expected = value instanceof Class javaClass ? javaClass.getName().getBytes() : value.toString().getBytes(); assertThat(bucket.asMap()).containsKey(DefaultRedisTypeMapper.DEFAULT_TYPE_KEY); assertThat(bucket.get(DefaultRedisTypeMapper.DEFAULT_TYPE_KEY)).isEqualTo(expected); diff --git a/src/test/java/org/springframework/data/redis/core/convert/Jsr310ConvertersTest.java b/src/test/java/org/springframework/data/redis/core/convert/Jsr310ConvertersTest.java index a95ca213ee..9b06715d80 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/Jsr310ConvertersTest.java +++ b/src/test/java/org/springframework/data/redis/core/convert/Jsr310ConvertersTest.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/test/java/org/springframework/data/redis/core/convert/KeyspaceIdentifierUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/KeyspaceIdentifierUnitTests.java index f115d1eb4e..1f965b71dd 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/KeyspaceIdentifierUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/KeyspaceIdentifierUnitTests.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/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java index aff41be615..c70b933f07 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/convert/PathIndexResolverUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/PathIndexResolverUnitTests.java index 8fa29d33c0..8a61c7a41c 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/PathIndexResolverUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/PathIndexResolverUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/convert/SpelIndexResolverUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/SpelIndexResolverUnitTests.java index 46c11631a3..153b3c9b65 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/SpelIndexResolverUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/SpelIndexResolverUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java index 9201e0b7cb..75c5d8a85e 100644 --- a/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java b/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java index f26bbf93da..a353d50573 100644 --- a/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.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. @@ -34,7 +34,6 @@ * @author Christoph Strobl * @author Mark Paluch * @param - * @param */ @ExtendWith(MockitoExtension.class) class BasicRedisPersistentEntityUnitTests { @@ -66,7 +65,8 @@ void addingMultipleIdPropertiesWithoutAnExplicitOneThrowsException() { entity.addPersistentProperty(property1); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> entity.addPersistentProperty(property2)) - .withMessageContaining("Attempt to add id property").withMessageContaining("but already have an property"); + .withMessageContaining("Attempt to add id property") + .withMessageContaining("but already have a property"); } @Test // DATAREDIS-425 @@ -84,7 +84,7 @@ void addingMultipleExplicitIdPropertiesThrowsException() { entity.addPersistentProperty(property1); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> entity.addPersistentProperty(property2)) .withMessageContaining("Attempt to add explicit id property") - .withMessageContaining("but already have an property"); + .withMessageContaining("but already have a property"); } @Test // DATAREDIS-425 diff --git a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareKeySpaceResolverUnitTests.java b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareKeySpaceResolverUnitTests.java index bf3e1d2ef7..182e73214d 100644 --- a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareKeySpaceResolverUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareKeySpaceResolverUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java index 9d78ac4a69..29f8804012 100644 --- a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/script/AbstractDefaultScriptExecutorTests.java b/src/test/java/org/springframework/data/redis/core/script/AbstractDefaultScriptExecutorTests.java index e6c8b3ce36..005212248f 100644 --- a/src/test/java/org/springframework/data/redis/core/script/AbstractDefaultScriptExecutorTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/AbstractDefaultScriptExecutorTests.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/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java index 7990d1a145..3676c27c24 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.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/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorUnitTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorUnitTests.java index 2c68eca8d7..456eed04ce 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorUnitTests.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/test/java/org/springframework/data/redis/core/script/DefaultRedisScriptTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultRedisScriptTests.java index a8b7c14797..3cb6445d39 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultRedisScriptTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultRedisScriptTests.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/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java index 40283a20f4..82a288fd8d 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/script/jedis/JedisDefaultScriptExecutorTests.java b/src/test/java/org/springframework/data/redis/core/script/jedis/JedisDefaultScriptExecutorTests.java index c9ba2e0eea..6488a36e02 100644 --- a/src/test/java/org/springframework/data/redis/core/script/jedis/JedisDefaultScriptExecutorTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/jedis/JedisDefaultScriptExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/script/lettuce/LettuceDefaultScriptExecutorTests.java b/src/test/java/org/springframework/data/redis/core/script/lettuce/LettuceDefaultScriptExecutorTests.java index a269a87203..8674f49458 100644 --- a/src/test/java/org/springframework/data/redis/core/script/lettuce/LettuceDefaultScriptExecutorTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/lettuce/LettuceDefaultScriptExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java b/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java index 681ca84b26..d9657bf247 100644 --- a/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/core/types/RedisClientInfoUnitTests.java b/src/test/java/org/springframework/data/redis/core/types/RedisClientInfoUnitTests.java index 893f9915ab..cdf85e7138 100644 --- a/src/test/java/org/springframework/data/redis/core/types/RedisClientInfoUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/types/RedisClientInfoUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/domain/geo/BoundingBoxUnitTests.java b/src/test/java/org/springframework/data/redis/domain/geo/BoundingBoxUnitTests.java index ab40d19bc7..5b5e642512 100644 --- a/src/test/java/org/springframework/data/redis/domain/geo/BoundingBoxUnitTests.java +++ b/src/test/java/org/springframework/data/redis/domain/geo/BoundingBoxUnitTests.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/test/java/org/springframework/data/redis/examples/ReactiveRedisApplication.java b/src/test/java/org/springframework/data/redis/examples/ReactiveRedisApplication.java index 4cac7b2eb1..1689d07a26 100644 --- a/src/test/java/org/springframework/data/redis/examples/ReactiveRedisApplication.java +++ b/src/test/java/org/springframework/data/redis/examples/ReactiveRedisApplication.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/test/java/org/springframework/data/redis/examples/RedisApplication.java b/src/test/java/org/springframework/data/redis/examples/RedisApplication.java index 21b01e228d..4ce9118321 100644 --- a/src/test/java/org/springframework/data/redis/examples/RedisApplication.java +++ b/src/test/java/org/springframework/data/redis/examples/RedisApplication.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/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java index 1ce50709dc..ddf8fdd66b 100644 --- a/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerUnitTests.java index 6402df5c4a..bc39e548e3 100644 --- a/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/listener/PubSubAwaitUtil.java b/src/test/java/org/springframework/data/redis/listener/PubSubAwaitUtil.java index 4b79d20d6a..557903967c 100644 --- a/src/test/java/org/springframework/data/redis/listener/PubSubAwaitUtil.java +++ b/src/test/java/org/springframework/data/redis/listener/PubSubAwaitUtil.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. @@ -87,8 +87,8 @@ public static void runAndAwaitChannelSubscription(RedisConnectionFactory connect private static long numPat(RedisConnection connection) { - if (connection instanceof LettuceConnection) { - return ((Number) ((LettuceConnection) connection).execute("PUBSUB", new IntegerOutput<>(ByteArrayCodec.INSTANCE), + if (connection instanceof LettuceConnection lettuceConnection) { + return ((Number) lettuceConnection.execute("PUBSUB", new IntegerOutput<>(ByteArrayCodec.INSTANCE), "NUMPAT".getBytes())).longValue(); } @@ -98,8 +98,8 @@ private static long numPat(RedisConnection connection) { private static long numSub(RedisConnection connection, String channel) { List pubsub; - if (connection instanceof LettuceConnection) { - pubsub = (List) ((LettuceConnection) connection).execute("PUBSUB", new ArrayOutput<>(ByteArrayCodec.INSTANCE), + if (connection instanceof LettuceConnection lettuceConnection) { + pubsub = (List) lettuceConnection.execute("PUBSUB", new ArrayOutput<>(ByteArrayCodec.INSTANCE), "NUMSUB".getBytes(), channel.getBytes()); } else { pubsub = (List) connection.execute("PUBSUB", "NUMSUB".getBytes(), channel.getBytes()); diff --git a/src/test/java/org/springframework/data/redis/listener/PubSubResubscribeTests.java b/src/test/java/org/springframework/data/redis/listener/PubSubResubscribeTests.java index 378c030499..63e441d77e 100644 --- a/src/test/java/org/springframework/data/redis/listener/PubSubResubscribeTests.java +++ b/src/test/java/org/springframework/data/redis/listener/PubSubResubscribeTests.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. @@ -236,10 +236,10 @@ private static boolean clusterAvailable() { private static boolean isClusterAware(RedisConnectionFactory connectionFactory) { - if (connectionFactory instanceof LettuceConnectionFactory) { - return ((LettuceConnectionFactory) connectionFactory).isClusterAware(); - } else if (connectionFactory instanceof JedisConnectionFactory) { - return ((JedisConnectionFactory) connectionFactory).isRedisClusterAware(); + if (connectionFactory instanceof LettuceConnectionFactory lettuceConnectionFactory) { + return lettuceConnectionFactory.isClusterAware(); + } else if (connectionFactory instanceof JedisConnectionFactory jedisConnectionFactory) { + return jedisConnectionFactory.isRedisClusterAware(); } return false; } diff --git a/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java b/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java index 78d03c6b1f..b034764d48 100644 --- a/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java +++ b/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.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/test/java/org/springframework/data/redis/listener/PubSubTests.java b/src/test/java/org/springframework/data/redis/listener/PubSubTests.java index 4f577dd447..1e0fb72dbb 100644 --- a/src/test/java/org/springframework/data/redis/listener/PubSubTests.java +++ b/src/test/java/org/springframework/data/redis/listener/PubSubTests.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. @@ -170,10 +170,10 @@ void testStartListenersToNoSpecificChannelTest() { private static boolean isClusterAware(RedisConnectionFactory connectionFactory) { - if (connectionFactory instanceof LettuceConnectionFactory) { - return ((LettuceConnectionFactory) connectionFactory).isClusterAware(); - } else if (connectionFactory instanceof JedisConnectionFactory) { - return ((JedisConnectionFactory) connectionFactory).isRedisClusterAware(); + if (connectionFactory instanceof LettuceConnectionFactory lettuce) { + return lettuce.isClusterAware(); + } else if (connectionFactory instanceof JedisConnectionFactory jedis) { + return jedis.isRedisClusterAware(); } return false; } diff --git a/src/test/java/org/springframework/data/redis/listener/ReactiveOperationsTestParams.java b/src/test/java/org/springframework/data/redis/listener/ReactiveOperationsTestParams.java index e1e71a7560..e31b479145 100644 --- a/src/test/java/org/springframework/data/redis/listener/ReactiveOperationsTestParams.java +++ b/src/test/java/org/springframework/data/redis/listener/ReactiveOperationsTestParams.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/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerIntegrationTests.java index 0e167fc65c..e990cea5f2 100644 --- a/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerIntegrationTests.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/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java index 256c5f65dd..f5e99bff47 100644 --- a/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.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/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerFailureIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerFailureIntegrationTests.java index 59b0d9bd52..6ecd8f4b75 100644 --- a/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerFailureIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerFailureIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerIntegrationTests.java index 4e4f571476..bea301b046 100644 --- a/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerUnitTests.java index 7d71909c71..ea7dfeb557 100644 --- a/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/RedisMessageListenerContainerUnitTests.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. @@ -19,6 +19,7 @@ import static org.mockito.Mockito.*; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; @@ -30,6 +31,7 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.core.task.SyncTaskExecutor; import org.springframework.data.redis.RedisConnectionFailureException; +import org.springframework.data.redis.connection.MessageListener; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.Subscription; @@ -44,6 +46,7 @@ * * @author Mark Paluch * @author Christoph Strobl + * @author Seongjun Lee */ class RedisMessageListenerContainerUnitTests { @@ -221,4 +224,19 @@ void shouldRecoverFromConnectionFailure() throws Exception { void failsOnDuplicateInit() { assertThatIllegalStateException().isThrownBy(() -> container.afterPropertiesSet()); } + + @Test // GH-3009 + void shouldRemoveAllListenersWhenListenerIsNull() { + + MessageListener listener1 = mock(MessageListener.class); + MessageListener listener2 = mock(MessageListener.class); + Topic topic = new ChannelTopic("topic1"); + + container.addMessageListener(listener1, Collections.singletonList(topic)); + container.addMessageListener(listener2, Collections.singletonList(topic)); + + container.removeMessageListener(null, Collections.singletonList(topic)); + + assertThatNoException().isThrownBy(() -> container.removeMessageListener(null, Collections.singletonList(topic))); + } } diff --git a/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java b/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java index 4d0701a3ea..6237e7e48f 100644 --- a/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.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/test/java/org/springframework/data/redis/listener/adapter/ContainerXmlSetupIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/adapter/ContainerXmlSetupIntegrationTests.java index ffa2f25f3c..48849ad11a 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/ContainerXmlSetupIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/ContainerXmlSetupIntegrationTests.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/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java index a8735c93ec..876118bd60 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.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/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java b/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java index 6536e0e79c..63788ffa7a 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.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/test/java/org/springframework/data/redis/listener/adapter/ThrowableMessageListener.java b/src/test/java/org/springframework/data/redis/listener/adapter/ThrowableMessageListener.java index 0d6465b656..eca3ff4e95 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/ThrowableMessageListener.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/ThrowableMessageListener.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/test/java/org/springframework/data/redis/mapping/AbstractHashMapperTests.java b/src/test/java/org/springframework/data/redis/mapping/AbstractHashMapperTests.java index af3cefe216..3807d13680 100644 --- a/src/test/java/org/springframework/data/redis/mapping/AbstractHashMapperTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/AbstractHashMapperTests.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/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java b/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java index 94d7488762..301056e3ea 100644 --- a/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.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/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java index 593d7ec594..5e5e2c95cf 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.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/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java index 608132504c..8b96474031 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.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. @@ -54,8 +54,8 @@ public class Jackson2HashMapperIntegrationTests { public Jackson2HashMapperIntegrationTests(RedisConnectionFactory factory) throws Exception { this.factory = factory; - if (factory instanceof InitializingBean) { - ((InitializingBean) factory).afterPropertiesSet(); + if (factory instanceof InitializingBean initializingBean) { + initializingBean.afterPropertiesSet(); } } diff --git a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java index 18c2f2b69b..688058c0ce 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.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/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java index 4ca104122f..5b8f392619 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.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. @@ -203,6 +203,15 @@ void bigDecimalShouldBeTreatedCorrectly() { assertBackAndForwardMapping(source); } + @Test // GH-2979 + void enumsShouldBeTreatedCorrectly() { + + WithEnumValue source = new WithEnumValue(); + source.value = SpringDataEnum.REDIS; + + assertBackAndForwardMapping(source); + } + public static class WithList { List strings; @@ -452,4 +461,38 @@ public int hashCode() { return Objects.hash(getValue()); } } + + enum SpringDataEnum { + COMMONS, REDIS + } + + static class WithEnumValue { + + SpringDataEnum value; + + public SpringDataEnum getValue() { + return value; + } + + public void setValue(SpringDataEnum value) { + this.value = value; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WithEnumValue that = (WithEnumValue) o; + return value == that.value; + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + } } diff --git a/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java b/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java index 31b74f2d57..823338e187 100644 --- a/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java index b02fea7953..b8623bb2e9 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java index 94009df445..780f630b6b 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java index 120fdc4c96..8437f2ef73 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/CdiExtensionIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/cdi/CdiExtensionIntegrationTests.java index dfbbffd692..a0b221b5aa 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/CdiExtensionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/CdiExtensionIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/Person.java b/src/test/java/org/springframework/data/redis/repository/cdi/Person.java index 8083246095..5a1d07e737 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/Person.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/Person.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. @@ -50,11 +50,9 @@ public void setName(String name) { public boolean equals(@Nullable Object o) { if (this == o) return true; - if (!(o instanceof Person)) + if (!(o instanceof Person person)) return false; - Person person = (Person) o; - if (id != null ? !id.equals(person.id) : person.id != null) return false; return name != null ? name.equals(person.name) : person.name == null; diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java b/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java index 237f08a970..38cc84d46b 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragment.java b/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragment.java index a5d81e8c00..08fee652ab 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragment.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragment.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragmentImpl.java b/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragmentImpl.java index 8bfc9c50ab..b17bdc9f3d 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragmentImpl.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/PersonFragmentImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/PersonRepository.java b/src/test/java/org/springframework/data/redis/repository/cdi/PersonRepository.java index ac82b1b4fe..4e6a6b6236 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/PersonRepository.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/PersonRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/QualifiedPersonRepository.java b/src/test/java/org/springframework/data/redis/repository/cdi/QualifiedPersonRepository.java index c04bf3d6bb..5dec512831 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/QualifiedPersonRepository.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/QualifiedPersonRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/RedisCdiDependenciesProducer.java b/src/test/java/org/springframework/data/redis/repository/cdi/RedisCdiDependenciesProducer.java index 88c310e7e4..67d0053687 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/RedisCdiDependenciesProducer.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/RedisCdiDependenciesProducer.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. @@ -63,8 +63,8 @@ public RedisOperations redisOperationsProducerQualified(RedisOpe public void closeRedisOperations(@Disposes RedisOperations redisOperations) throws Exception { - if (redisOperations instanceof DisposableBean) { - ((DisposableBean) redisOperations).destroy(); + if (redisOperations instanceof DisposableBean disposableBean) { + disposableBean.destroy(); } } diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java b/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java index 300f37f818..0f9701bc94 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtensionUnitTests.java b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtensionUnitTests.java index 008cb091e3..b515de2ac4 100644 --- a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtensionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationExtensionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationUnitTests.java index b2a21f454f..9ef5506258 100644 --- a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoryConfigurationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformationUnitTests.java b/src/test/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformationUnitTests.java index 746a7e4cca..6637d6f83e 100644 --- a/src/test/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/core/MappingRedisEntityInformationUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java b/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java index 445beb8f38..9a99d12538 100644 --- a/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.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/test/java/org/springframework/data/redis/repository/query/RedisQueryCreatorUnitTests.java b/src/test/java/org/springframework/data/redis/repository/query/RedisQueryCreatorUnitTests.java index 8cd54ae12c..c088ff751c 100644 --- a/src/test/java/org/springframework/data/redis/repository/query/RedisQueryCreatorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/query/RedisQueryCreatorUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java index ebcec9b870..0c29bc6e6a 100644 --- a/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.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/test/java/org/springframework/data/redis/serializer/DefaultRedisElementReaderUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementReaderUnitTests.java index 7be9d472cf..4e9c9759ef 100644 --- a/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementReaderUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementReaderUnitTests.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/test/java/org/springframework/data/redis/serializer/DefaultRedisElementWriterUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementWriterUnitTests.java index 440c45ac04..e971c6dd8b 100644 --- a/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/DefaultRedisElementWriterUnitTests.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/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java index 7f54a324cf..7d67fdb7cf 100644 --- a/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.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,20 +15,10 @@ */ package org.springframework.data.redis.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import static org.springframework.test.util.ReflectionTestUtils.getField; -import static org.springframework.util.ObjectUtils.nullSafeEquals; -import static org.springframework.util.ObjectUtils.nullSafeHashCode; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; +import static org.springframework.test.util.ReflectionTestUtils.*; +import static org.springframework.util.ObjectUtils.*; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -51,13 +41,17 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; +import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; +import com.fasterxml.jackson.databind.jsontype.TypeSerializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; @@ -74,9 +68,14 @@ class GenericJackson2JsonRedisSerializerUnitTests { private static final SimpleObject SIMPLE_OBJECT = new SimpleObject(1L); private static final ComplexObject COMPLEX_OBJECT = new ComplexObject("steelheart", SIMPLE_OBJECT); - @Test // DATAREDIS-392 + @Test // DATAREDIS-392, GH-2878 void shouldUseDefaultTyping() { assertThat(extractTypeResolver(new GenericJackson2JsonRedisSerializer())).isNotNull(); + assertThat(extractTypeResolver(GenericJackson2JsonRedisSerializer.builder().build())).isNotNull(); + assertThat(extractTypeResolver(GenericJackson2JsonRedisSerializer.builder().defaultTyping(false).build())).isNull(); + assertThat( + extractTypeResolver(GenericJackson2JsonRedisSerializer.builder().objectMapper(new ObjectMapper()).build())) + .isNull(); } @Test // DATAREDIS-392 @@ -98,12 +97,13 @@ void shouldUseDefaultTypingWhenClassPropertyNameIsNull() { @Test // DATAREDIS-392 void shouldUseDefaultTypingWhenClassPropertyNameIsProvided() { - TypeResolverBuilder typeResolver = extractTypeResolver(new GenericJackson2JsonRedisSerializer("firefight")); + TypeResolverBuilder typeResolver = extractTypeResolver( + GenericJackson2JsonRedisSerializer.builder().typeHintPropertyName("firefight").build()); assertThat((String) getField(typeResolver, "_typeProperty")).isEqualTo("firefight"); } @Test // DATAREDIS-392 - void serializeShouldReturnEmptyByteArrayWhenSouceIsNull() { + void serializeShouldReturnEmptyByteArrayWhenSourceIsNull() { assertThat(new GenericJackson2JsonRedisSerializer().serialize(null)).isEqualTo(SerializationUtils.EMPTY_ARRAY); } @@ -227,10 +227,10 @@ void shouldConsiderWriter() { user.id = 42; user.name = "Walter White"; - GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer((String) null, - JacksonObjectReader.create(), (mapper, source) -> { + GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() + .writer((mapper, source) -> { return mapper.writerWithView(Views.Basic.class).writeValueAsBytes(source); - }); + }).build(); byte[] result = serializer.serialize(user); @@ -240,10 +240,10 @@ void shouldConsiderWriter() { @Test // GH-2322 void considersWriterForCustomObjectMapper() { - GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(new ObjectMapper(), - JacksonObjectReader.create(), (mapper, source) -> { + GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() + .objectMapper(new ObjectMapper()).writer((mapper, source) -> { return mapper.writerWithView(Views.Basic.class).writeValueAsBytes(source); - }); + }).build(); User user = new User(); user.email = "walter@heisenberg.com"; @@ -263,13 +263,14 @@ void shouldConsiderReader() { user.id = 42; user.name = "Walter White"; - GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer((String) null, + GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() + .reader( (mapper, source, type) -> { if (type.getRawClass() == User.class) { return mapper.readerWithView(Views.Basic.class).forType(type).readValue(source); } return mapper.readValue(source, type); - }, JacksonObjectWriter.create()); + }).build(); byte[] serializedValue = serializer.serialize(user); @@ -420,7 +421,7 @@ void deserializesJavaTimeFrimBytes() { } @Test // GH-2601 - public void internalObjectMapperCustomization() { + void internalObjectMapperCustomization() { GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(); @@ -432,13 +433,13 @@ public void internalObjectMapperCustomization() { assertThat(serializer.configure(configurer)).isSameAs(serializer); - verify(mockObjectMapper, times(1)).registerModule(eq(mockModule)); + verify(mockObjectMapper).registerModule(mockModule); verifyNoMoreInteractions(mockObjectMapper); verifyNoInteractions(mockModule); } @Test // GH-2601 - public void configureWithNullConsumerThrowsIllegalArgumentException() { + void configureWithNullConsumerThrowsIllegalArgumentException() { assertThatIllegalArgumentException() .isThrownBy(() -> new GenericJackson2JsonRedisSerializer().configure(null)) @@ -446,6 +447,46 @@ public void configureWithNullConsumerThrowsIllegalArgumentException() { .withNoCause(); } + @Test + void defaultSerializeAndDeserializeNullValueWithBuilderClass() { + GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() + .objectMapper(new ObjectMapper().enableDefaultTyping(DefaultTyping.EVERYTHING, As.PROPERTY)) + .build(); + + serializeAndDeserializeNullValue(serializer); + } + + @Test // GH-2878 + void customNullValueSerializer() { + + StdSerializer nullValueSerializer = new StdSerializer<>(NullValue.class) { + @Override + public void serialize(NullValue nullValue, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException { + jsonGenerator.writeNull(); + } + + @Override + public void serializeWithType(NullValue value, JsonGenerator jsonGenerator, SerializerProvider serializers, + TypeSerializer typeSerializer) throws IOException { + + serialize(value, jsonGenerator, serializers); + } + }; + + GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() + .nullValueSerializer(nullValueSerializer) + .build(); + + NullValue nv = BeanUtils.instantiateClass(NullValue.class); + + byte[] serializedValue = serializer.serialize(nv); + assertThat(serializedValue).isNotNull(); + + Object deserializedValue = serializer.deserialize(serializedValue); + assertThat(deserializedValue).isNull(); + } + private static void serializeAndDeserializeNullValue(GenericJackson2JsonRedisSerializer serializer) { NullValue nv = BeanUtils.instantiateClass(NullValue.class); @@ -457,6 +498,7 @@ private static void serializeAndDeserializeNullValue(GenericJackson2JsonRedisSer assertThat(deserializedValue).isInstanceOf(NullValue.class); } + @Nullable private TypeResolverBuilder extractTypeResolver(GenericJackson2JsonRedisSerializer serializer) { ObjectMapper mapper = (ObjectMapper) getField(serializer, "mapper"); @@ -572,10 +614,9 @@ public boolean equals(@Nullable Object obj) { if (obj == null) { return false; } - if (!(obj instanceof SimpleObject)) { + if (!(obj instanceof SimpleObject other)) { return false; } - SimpleObject other = (SimpleObject) obj; return nullSafeEquals(this.longValue, other.longValue); } } diff --git a/src/test/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializerTests.java b/src/test/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializerTests.java index dab08d2c0c..da98eff85d 100644 --- a/src/test/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializerTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/Jackson2JsonRedisSerializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java index e435f57b6e..0d15d0b23b 100644 --- a/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.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/test/java/org/springframework/data/redis/serializer/SerializableDomainClass.java b/src/test/java/org/springframework/data/redis/serializer/SerializableDomainClass.java index 46e5712ba1..f02625ce68 100644 --- a/src/test/java/org/springframework/data/redis/serializer/SerializableDomainClass.java +++ b/src/test/java/org/springframework/data/redis/serializer/SerializableDomainClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java b/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java index af21b6a1fb..f76a4fa5d6 100644 --- a/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.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/test/java/org/springframework/data/redis/serializer/StringRedisSerializerUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/StringRedisSerializerUnitTests.java index 88c99848a8..58d6fd3f93 100644 --- a/src/test/java/org/springframework/data/redis/serializer/StringRedisSerializerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/StringRedisSerializerUnitTests.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/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java index 8df2d894f9..26318b1448 100644 --- a/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.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. @@ -15,7 +15,10 @@ */ package org.springframework.data.redis.stream; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; + +import io.lettuce.core.codec.StringCodec; +import io.lettuce.core.output.NestedMultiOutput; import java.time.Duration; import java.util.Collections; @@ -48,9 +51,6 @@ import org.springframework.data.redis.test.condition.EnabledOnCommand; import org.springframework.util.NumberUtils; -import io.lettuce.core.codec.StringCodec; -import io.lettuce.core.output.NestedMultiOutput; - /** * Integration tests for {@link StreamMessageListenerContainer}. * @@ -395,9 +395,9 @@ private int getNumberOfPending(String stream, String group) { RedisConnection connection = connectionFactory.getConnection(); - if (connection instanceof LettuceConnection) { + if (connection instanceof LettuceConnection lettuce) { - String value = ((List) ((LettuceConnection) connectionFactory.getConnection()).execute("XPENDING", + String value = ((List) lettuce.execute("XPENDING", new NestedMultiOutput<>(StringCodec.UTF8), new byte[][] { stream.getBytes(), group.getBytes() })).get(0) .toString(); return NumberUtils.parseNumber(value, Integer.class); diff --git a/src/test/java/org/springframework/data/redis/stream/JedisStreamMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/JedisStreamMessageListenerContainerIntegrationTests.java index e8c2ed56ec..e6e27f7548 100644 --- a/src/test/java/org/springframework/data/redis/stream/JedisStreamMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/JedisStreamMessageListenerContainerIntegrationTests.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/test/java/org/springframework/data/redis/stream/LettuceStreamMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/LettuceStreamMessageListenerContainerIntegrationTests.java index 5a6357fefe..91c6f42c19 100644 --- a/src/test/java/org/springframework/data/redis/stream/LettuceStreamMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/LettuceStreamMessageListenerContainerIntegrationTests.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/test/java/org/springframework/data/redis/stream/ReadOffsetStrategyUnitTests.java b/src/test/java/org/springframework/data/redis/stream/ReadOffsetStrategyUnitTests.java index dac2fe205f..dfb1e24c7f 100644 --- a/src/test/java/org/springframework/data/redis/stream/ReadOffsetStrategyUnitTests.java +++ b/src/test/java/org/springframework/data/redis/stream/ReadOffsetStrategyUnitTests.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/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java index 5abe16c2c3..48cc363879 100644 --- a/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.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. @@ -15,11 +15,13 @@ */ package org.springframework.data.redis.stream; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import java.nio.ByteBuffer; import java.time.Duration; @@ -51,10 +53,6 @@ import org.springframework.data.redis.stream.StreamReceiver.StreamReceiverOptions; import org.springframework.data.redis.test.condition.EnabledOnCommand; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - /** * Integration tests for {@link StreamReceiver}. * @@ -227,13 +225,13 @@ void shouldReceiveAsConsumerGroupMessages() { .consumeNextWith(it -> { assertThat(it.getStream()).isEqualTo("my-stream"); - // assertThat(it.getValue()).containsEntry("key", "value"); - assertThat(it.getValue()).containsValue("value"); + + assertThat(it.getValue().values()).containsAnyOf("value", "value2"); }).consumeNextWith(it -> { assertThat(it.getStream()).isEqualTo("my-stream"); // assertThat(it.getValue()).containsEntry("key2", "value2"); - assertThat(it.getValue()).containsValue("value2"); + assertThat(it.getValue().values()).containsAnyOf("value", "value2"); }) // .thenCancel() // .verify(Duration.ofSeconds(5)); diff --git a/src/test/java/org/springframework/data/redis/support/BoundKeyOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/BoundKeyOperationsIntegrationTests.java index e193f58618..ad510f97e5 100644 --- a/src/test/java/org/springframework/data/redis/support/BoundKeyOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/BoundKeyOperationsIntegrationTests.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. @@ -119,14 +119,14 @@ void testPersist() throws Exception { @SuppressWarnings({ "unchecked", "rawtypes" }) private void populateBoundKey() { - if (keyOps instanceof Collection) { - ((Collection) keyOps).add("dummy"); - } else if (keyOps instanceof Map) { - ((Map) keyOps).put("dummy", "dummy"); - } else if (keyOps instanceof RedisAtomicInteger) { - ((RedisAtomicInteger) keyOps).set(42); - } else if (keyOps instanceof RedisAtomicLong) { - ((RedisAtomicLong) keyOps).set(42L); + if (keyOps instanceof Collection collection) { + collection.add("dummy"); + } else if (keyOps instanceof Map map) { + map.put("dummy", "dummy"); + } else if (keyOps instanceof RedisAtomicInteger atomic) { + atomic.set(42); + } else if (keyOps instanceof RedisAtomicLong atomic) { + atomic.set(42L); } } } diff --git a/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java b/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java index 3624336f2c..89b7270a3d 100644 --- a/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java +++ b/src/test/java/org/springframework/data/redis/support/BoundKeyParams.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/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java index f958c93fce..15393f3cc6 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.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/test/java/org/springframework/data/redis/support/atomic/CompareAndSetIntegrationIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/atomic/CompareAndSetIntegrationIntegrationTests.java index 0d4b899cf2..6e436a7365 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/CompareAndSetIntegrationIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/CompareAndSetIntegrationIntegrationTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java index 6a1302c0c9..f8941ffe8a 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleUnitTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleUnitTests.java index c504e5fe61..22ed35e76b 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleUnitTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerIntegrationTests.java index cd7a4332bf..d5d9ea8bcc 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerIntegrationTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerUnitTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerUnitTests.java index eeb14ccc2f..3e58c78919 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicIntegerUnitTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongIntegrationTests.java index 21e22125a6..21ba2729f4 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongIntegrationTests.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/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongUnitTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongUnitTests.java index cd4a349183..1e22396d63 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicLongUnitTests.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/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionIntegrationTests.java index 5f6b5ca85b..e4a0cbcd8e 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java index 47f75e4576..6fe195d0fc 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java index 1306f0d795..692a967c1f 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/AbstractRedisMapIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisMapIntegrationTests.java index 3f4e17d439..435d5b4500 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisMapIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisMapIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java index 60e839548e..8319ee373a 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/AbstractRedisZSetTestIntegration.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisZSetTestIntegration.java index 20e647c45f..9f443dc7ff 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisZSetTestIntegration.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisZSetTestIntegration.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/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java index 3ea95932a5..8b9063497f 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java +++ b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.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/test/java/org/springframework/data/redis/support/collections/DefaultRedisMapUnitUnitTests.java b/src/test/java/org/springframework/data/redis/support/collections/DefaultRedisMapUnitUnitTests.java index f946511750..637a4a690d 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/DefaultRedisMapUnitUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/DefaultRedisMapUnitUnitTests.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/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java index 4075821b4e..ecff984147 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.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/test/java/org/springframework/data/redis/support/collections/RedisListIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisListIntegrationTests.java index 9102a0f1a8..bceca49729 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisListIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisListIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java index d6ac4b7911..b54c1ba7ec 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java index 9f4fd59b7f..17e63c3113 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/RedisSetIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisSetIntegrationTests.java index cde7e8d8dc..6a0228d346 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisSetIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisSetIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/RedisZSetIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisZSetIntegrationTests.java index 86b3fa4a50..d508e0af78 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisZSetIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisZSetIntegrationTests.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/test/java/org/springframework/data/redis/support/collections/SupportXmlIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/SupportXmlIntegrationTests.java index 656b8966d9..d9857db8e5 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/SupportXmlIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/SupportXmlIntegrationTests.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/test/java/org/springframework/data/redis/test/XstreamOxmSerializerSingleton.java b/src/test/java/org/springframework/data/redis/test/XstreamOxmSerializerSingleton.java index ee03b5711c..c22b4216af 100644 --- a/src/test/java/org/springframework/data/redis/test/XstreamOxmSerializerSingleton.java +++ b/src/test/java/org/springframework/data/redis/test/XstreamOxmSerializerSingleton.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/test/java/org/springframework/data/redis/test/condition/EnabledIfLongRunningTest.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledIfLongRunningTest.java index 436be6983a..cee6fede5e 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledIfLongRunningTest.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledIfLongRunningTest.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/test/java/org/springframework/data/redis/test/condition/EnabledOnCommand.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommand.java index 346c359987..a9db6d17f5 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommand.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommand.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/test/java/org/springframework/data/redis/test/condition/EnabledOnCommandCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommandCondition.java index 9d5887ec63..1844acbb8a 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommandCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnCommandCondition.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailable.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailable.java index a5f3c31411..0d396cf41f 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailable.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailable.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java index f1c73953df..b7ec1f82d9 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.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. @@ -57,10 +57,10 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con socket.connect(new InetSocketAddress(SettingsUtils.getHost(), annotation.value()), 100); - return enabled(String.format("Connection successful to Redis at %s:%d", SettingsUtils.getHost(), + return enabled("Connection successful to Redis at %s:%d".formatted(SettingsUtils.getHost(), annotation.value())); } catch (IOException ex) { - return disabled(String.format("Cannot connect to Redis at %s:%d (%s)", SettingsUtils.getHost(), + return disabled("Cannot connect to Redis at %s:%d (%s)".formatted(SettingsUtils.getHost(), annotation.value(), ex)); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterAvailable.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterAvailable.java index feebd4ad6d..f25cd153e0 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterAvailable.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterAvailable.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java index f67cf4d3f8..fe30380184 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.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. @@ -48,11 +48,11 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con } if (RedisDetector.isClusterAvailable()) { - return enabled(String.format("Connection successful to Redis Cluster at %s:%d", SettingsUtils.getHost(), + return enabled("Connection successful to Redis Cluster at %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getClusterPort())); } - return disabled(String.format("Cannot connect to Redis Cluster at %s:%d", SettingsUtils.getHost(), + return disabled("Cannot connect to Redis Cluster at %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getClusterPort())); } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriver.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriver.java index c904ae9543..7e2da2bef0 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriver.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriver.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java index d4fbf0e78b..68286b5e86 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.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. @@ -81,13 +81,12 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con } if (!foundMatch) { - return disabled(String.format("Driver %s not supported; Supported driver(s): %s", - formatUnsupportedDriver(value), - Arrays.toString(annotation.value()))); + return disabled("Driver %s not supported; Supported driver(s): %s" + .formatted(formatUnsupportedDriver(value), Arrays.toString(annotation.value()))); } } - return enabled("Found enabled driver(s): " + Arrays.toString(annotation.value())); + return enabled("Found enabled driver(s): %s".formatted(Arrays.toString(annotation.value()))); } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelAvailable.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelAvailable.java index b2f225026f..42d29b9a11 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelAvailable.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelAvailable.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java index 9a59d80ba8..26b2665d4d 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.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. @@ -52,12 +52,11 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con if (RedisDetector.canConnectToPort(annotation.value())) { - return enabled(String.format("Connection successful to Redis Sentinel at %s:%d", SettingsUtils.getHost(), + return enabled("Connection successful to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), annotation.value())); } - return disabled( - String.format("Cannot connect to Redis Sentinel at %s:%d", SettingsUtils.getHost(), annotation.value())); - + return disabled("Cannot connect to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), + annotation.value())); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersion.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersion.java index e3c6ab3d67..326e27be64 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersion.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersion.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/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java index f23bfd11aa..5aec897431 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.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. @@ -61,11 +61,14 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con } }, RedisConditions.class); - boolean versionMet = conditions.hasVersionGreaterOrEqualsTo(requiredVersion); - return versionMet - ? enabled( - String.format("Enabled on version %s (actual version: %s)", requiredVersion, conditions.getRedisVersion())) - : disabled(String.format("Disabled, version %s not available on Redis version %s", requiredVersion, - conditions.getRedisVersion())); + boolean requiredVersionMet = conditions.hasVersionGreaterOrEqualsTo(requiredVersion); + + if (requiredVersionMet) { + return enabled("Enabled on version %s; actual version: %s".formatted(requiredVersion, + conditions.getRedisVersion())); + } + + return disabled("Disabled; version %s not available on Redis version %s".formatted(requiredVersion, + conditions.getRedisVersion())); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/LongRunningTest.java b/src/test/java/org/springframework/data/redis/test/condition/LongRunningTest.java index ce1495bcf0..2114fa1bbc 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/LongRunningTest.java +++ b/src/test/java/org/springframework/data/redis/test/condition/LongRunningTest.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/test/java/org/springframework/data/redis/test/condition/RedisConditions.java b/src/test/java/org/springframework/data/redis/test/condition/RedisConditions.java index 26c5d1d29c..77ce6bf311 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/RedisConditions.java +++ b/src/test/java/org/springframework/data/redis/test/condition/RedisConditions.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. @@ -65,7 +65,7 @@ private RedisConditions(RedisClusterCommands commands) { /** * Create {@link RedisCommands} given {@link StatefulRedisConnection}. * - * @param connection must not be {@code null}. + * @param connection must not be {@literal null}. * @return */ public static RedisConditions of(StatefulRedisConnection connection) { @@ -75,7 +75,7 @@ public static RedisConditions of(StatefulRedisConnection connect /** * Create {@link RedisCommands} given {@link StatefulRedisClusterConnection}. * - * @param connection must not be {@code null}. + * @param connection must not be {@literal null}. * @return */ public static RedisConditions of(StatefulRedisClusterConnection connection) { @@ -85,7 +85,7 @@ public static RedisConditions of(StatefulRedisClusterConnection /** * Create {@link RedisConditions} given {@link RedisCommands}. * - * @param commands must not be {@code null}. + * @param commands must not be {@literal null}. * @return */ public static RedisConditions of(RedisClusterCommands commands) { diff --git a/src/test/java/org/springframework/data/redis/test/condition/RedisDetector.java b/src/test/java/org/springframework/data/redis/test/condition/RedisDetector.java index 5195c3f28a..d0f3e50fcf 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/RedisDetector.java +++ b/src/test/java/org/springframework/data/redis/test/condition/RedisDetector.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/test/java/org/springframework/data/redis/test/condition/RedisDriver.java b/src/test/java/org/springframework/data/redis/test/condition/RedisDriver.java index 6c0240275f..6c73e50fb0 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/RedisDriver.java +++ b/src/test/java/org/springframework/data/redis/test/condition/RedisDriver.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/test/java/org/springframework/data/redis/test/extension/JedisExtension.java b/src/test/java/org/springframework/data/redis/test/extension/JedisExtension.java index cd77b39ee4..cdf9225e8b 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/JedisExtension.java +++ b/src/test/java/org/springframework/data/redis/test/extension/JedisExtension.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/test/java/org/springframework/data/redis/test/extension/LettuceExtension.java b/src/test/java/org/springframework/data/redis/test/extension/LettuceExtension.java index a87cb5f1dc..949a0fba7c 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/LettuceExtension.java +++ b/src/test/java/org/springframework/data/redis/test/extension/LettuceExtension.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/test/java/org/springframework/data/redis/test/extension/LettuceTestClientResources.java b/src/test/java/org/springframework/data/redis/test/extension/LettuceTestClientResources.java index 8cdc9be407..90a57e8a3a 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/LettuceTestClientResources.java +++ b/src/test/java/org/springframework/data/redis/test/extension/LettuceTestClientResources.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/test/java/org/springframework/data/redis/test/extension/RedisCluster.java b/src/test/java/org/springframework/data/redis/test/extension/RedisCluster.java index 10c2c236a9..5af80603ce 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/RedisCluster.java +++ b/src/test/java/org/springframework/data/redis/test/extension/RedisCluster.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/test/java/org/springframework/data/redis/test/extension/RedisSentinel.java b/src/test/java/org/springframework/data/redis/test/extension/RedisSentinel.java index c589838987..85218ddb5b 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/RedisSentinel.java +++ b/src/test/java/org/springframework/data/redis/test/extension/RedisSentinel.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/test/java/org/springframework/data/redis/test/extension/RedisStanalone.java b/src/test/java/org/springframework/data/redis/test/extension/RedisStanalone.java index 625b518465..e04679eb94 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/RedisStanalone.java +++ b/src/test/java/org/springframework/data/redis/test/extension/RedisStanalone.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/test/java/org/springframework/data/redis/test/extension/ShutdownQueue.java b/src/test/java/org/springframework/data/redis/test/extension/ShutdownQueue.java index 8f8d760351..f818e17e55 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/ShutdownQueue.java +++ b/src/test/java/org/springframework/data/redis/test/extension/ShutdownQueue.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/test/java/org/springframework/data/redis/test/extension/parametrized/MethodArgumentsProvider.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodArgumentsProvider.java index ed3b602908..896192fc83 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodArgumentsProvider.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodArgumentsProvider.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/test/java/org/springframework/data/redis/test/extension/parametrized/MethodSource.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodSource.java index 4c9bc494b9..38e4477242 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodSource.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/MethodSource.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/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTest.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTest.java index 9f80af0bc8..efdef385d3 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTest.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTest.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/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java index 7b89c271bb..0e295527ed 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.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. @@ -61,10 +61,11 @@ public boolean supportsTestTemplate(ExtensionContext context) { ParameterizedTestContext methodContext = new ParameterizedTestContext(testMethod); ParameterizedTestContext constructorContext = new ParameterizedTestContext(declaredConstructor); - Preconditions.condition(methodContext.hasPotentiallyValidSignature(), - () -> String.format("@ParameterizedRedisTest method [%s] declares formal parameters in an invalid order: " + Preconditions.condition(methodContext.hasPotentiallyValidSignature(), () -> + ("@ParameterizedRedisTest method [%s] declares formal parameters in an invalid order: " + "argument aggregators must be declared after any indexed arguments " - + "and before any arguments resolved by another ParameterResolver.", testMethod.toGenericString())); + + "and before any arguments resolved by another ParameterResolver.") + .formatted(testMethod.toGenericString())); getStore(context).put(METHOD_CONTEXT_KEY, methodContext); getStore(context).put(CONSTRUCTOR_CONTEXT_KEY, constructorContext); @@ -115,10 +116,9 @@ private ArgumentsProvider instantiateArgumentsProvider(Class String.format( - "Configuration error: @ParameterizedRedisTest on method [%s] must be declared with a non-empty name.", - templateMethod)); + + String pattern = Preconditions.notBlank(parameterizedTest.name().trim(), () -> + "Configuration error: @ParameterizedRedisTest on method [%s] must be declared with a non-empty name" + .formatted(templateMethod)); + return new ParameterizedTestNameFormatter(pattern, displayName, methodContext, argumentMaxLength); } diff --git a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestContext.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestContext.java index af4e61eb18..6d1dd069f1 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestContext.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestContext.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/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestInvocationContext.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestInvocationContext.java index 5e3b365405..658cd29b20 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestInvocationContext.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestInvocationContext.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/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java index d67c7399ac..7c02a0171f 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.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. @@ -53,9 +53,8 @@ String format(int invocationIndex, Object... arguments) { try { return formatSafely(invocationIndex, arguments); } catch (Exception ex) { - String message = "The display name pattern defined for the parameterized test is invalid; " - + "See nested exception for further details."; - throw new JUnitException(message, ex); + throw new JUnitException("The display name pattern defined for the parameterized test is invalid;" + + " See nested exception for further details.", ex); } } diff --git a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestParameterResolver.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestParameterResolver.java index 4a644c744b..adcff56f32 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestParameterResolver.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestParameterResolver.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/test/java/org/springframework/data/redis/test/util/CollectionAwareComparator.java b/src/test/java/org/springframework/data/redis/test/util/CollectionAwareComparator.java index b150a16a72..c505f89375 100644 --- a/src/test/java/org/springframework/data/redis/test/util/CollectionAwareComparator.java +++ b/src/test/java/org/springframework/data/redis/test/util/CollectionAwareComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,7 @@ public enum CollectionAwareComparator implements Comparator { @Override public int compare(Object o1, Object o2) { - if (o1 instanceof Collection && o2 instanceof Collection) { - - Collection c1 = (Collection) o1; - Collection c2 = (Collection) o2; + if (o1 instanceof Collection c1 && o2 instanceof Collection c2) { if (c1.size() != c2.size()) { return 1; diff --git a/src/test/java/org/springframework/data/redis/test/util/HexStringUtils.java b/src/test/java/org/springframework/data/redis/test/util/HexStringUtils.java index f6401d6ee5..388d877fdf 100644 --- a/src/test/java/org/springframework/data/redis/test/util/HexStringUtils.java +++ b/src/test/java/org/springframework/data/redis/test/util/HexStringUtils.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/test/java/org/springframework/data/redis/test/util/MockitoUtils.java b/src/test/java/org/springframework/data/redis/test/util/MockitoUtils.java index 5a384bb838..24d5eb41b3 100644 --- a/src/test/java/org/springframework/data/redis/test/util/MockitoUtils.java +++ b/src/test/java/org/springframework/data/redis/test/util/MockitoUtils.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. @@ -68,7 +68,7 @@ public boolean matches(Invocation actual) { @Override public String toString() { - return String.format("%s for method: %s", mode, method); + return "%s for method: %s".formatted(mode, method); } })); } diff --git a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java index c0ca6e6f8d..959f0da9bb 100644 --- a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java +++ b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public RedisBucketAssert containingTypeHint(String path, Class type) { isNotNull(); - String hint = String.format("Type hint for <%s> at <%s>", type.getName(), path); + String hint = "Type hint for <%s> at <%s>".formatted(type.getName(), path); if (!actual.containsKey(path)) { diff --git a/src/test/java/org/springframework/data/redis/util/ByteUtilsUnitTests.java b/src/test/java/org/springframework/data/redis/util/ByteUtilsUnitTests.java index 068c0ea716..6a60dac053 100644 --- a/src/test/java/org/springframework/data/redis/util/ByteUtilsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/util/ByteUtilsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the original author or authors. + * Copyright 2021-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/springframework/data/redis/util/ConnectionVerifier.java b/src/test/java/org/springframework/data/redis/util/ConnectionVerifier.java index 32dc8dc89b..90af8cb259 100644 --- a/src/test/java/org/springframework/data/redis/util/ConnectionVerifier.java +++ b/src/test/java/org/springframework/data/redis/util/ConnectionVerifier.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/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java b/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java deleted file mode 100644 index d9fbe94d1c..0000000000 --- a/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2017-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.util; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyNoMoreInteractions; - -import java.util.function.Supplier; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import org.springframework.dao.InvalidDataAccessApiUsageException; - -/** - * Unit Tests for {@link RedisAssertions}. - * - * @author John Blum - */ -@ExtendWith(MockitoExtension.class) -class RedisAssertionsUnitTests { - - @Mock - private Supplier mockSupplier; - - @Test - void requireNonNullWithMessageAndArgumentsIsSuccessful() { - assertThat(RedisAssertions.requireNonNull("test", "Test message")).isEqualTo("test"); - } - - @Test - void requireNonNullWithMessageAndArgumentsThrowsIllegalArgumentException() { - - assertThatIllegalArgumentException() - .isThrownBy(() -> RedisAssertions.requireNonNull(null, "This is a %s", "test")) - .withMessage("This is a test") - .withNoCause(); - } - - @Test - void requireNonNullWithSupplierIsSuccessful() { - - assertThat(RedisAssertions.requireNonNull("mock", this.mockSupplier)).isEqualTo("mock"); - - verifyNoInteractions(this.mockSupplier); - } - - @Test - void requireNonNullWithSupplierThrowsIllegalArgumentException() { - - doReturn("Mock message").when(this.mockSupplier).get(); - - assertThatIllegalArgumentException() - .isThrownBy(() -> RedisAssertions.requireNonNull(null, this.mockSupplier)) - .withMessage("Mock message") - .withNoCause(); - - verify(this.mockSupplier, times(1)).get(); - verifyNoMoreInteractions(this.mockSupplier); - } - - @Test - void requireNonNullWithRuntimeExceptionSupplierIsSuccessful() { - - assertThat(RedisAssertions.requireNonNull("mock", () -> new InvalidDataAccessApiUsageException("TEST"))) - .isEqualTo("mock"); - } - - @Test - @SuppressWarnings("all") - void requireNonNullWithThrowsRuntimeException() { - - assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) - .isThrownBy(() -> RedisAssertions.requireNonNull(null, - () -> new InvalidDataAccessApiUsageException("TEST"))) - .withMessage("TEST") - .withNoCause(); - } - - @Test - void requireStateWithMessageAndArgumentsIsSuccessful() { - assertThat(RedisAssertions.requireState("test", "Mock message")).isEqualTo("test"); - } - - @Test - void requireStateWithMessageAndArgumentsThrowsIllegalStateException() { - - assertThatIllegalStateException() - .isThrownBy(() -> RedisAssertions.requireState(null, "This is a %s", "test")) - .withMessage("This is a test") - .withNoCause(); - } - - @Test - void requireStateWithSupplierIsSuccessful() { - - assertThat(RedisAssertions.requireState("test", this.mockSupplier)).isEqualTo("test"); - - verifyNoInteractions(this.mockSupplier); - } - - @Test - void requiredStateWithSupplierThrowsIllegalStateException() { - - doReturn("Mock message").when(this.mockSupplier).get(); - - assertThatIllegalStateException() - .isThrownBy(() -> RedisAssertions.requireState(null, this.mockSupplier)) - .withMessage("Mock message") - .withNoCause(); - - verify(this.mockSupplier, times(1)).get(); - verifyNoMoreInteractions(this.mockSupplier); - } -} diff --git a/src/test/kotlin/org/springframework/data/redis/core/PartialUpdateExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/PartialUpdateExtensionsUnitTests.kt index eb89fb123f..846cf66c04 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/PartialUpdateExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/PartialUpdateExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensionsUnitTests.kt index ce18d3cfee..ccb6737846 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveGeoOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensionsUnitTests.kt index 11a6c62164..61b00cde04 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveHashOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensionsUnitTests.kt index df1535e475..b1dcfe15df 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveHyperLogLogOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensionsUnitTests.kt index e9a2519208..779b44371c 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveListOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensionsUnitTests.kt index 970d81faca..62a6c968f3 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveRedisOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensionsUnitTests.kt index 30af755677..f7ec83678d 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveSetOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensionsUnitTests.kt index 9e14277fb4..22ea0603af 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveStreamOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensionsUnitTests.kt index 748ff04a05..50ad68e9d2 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveValueOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensionsUnitTests.kt index 9f7f52175f..91c75933ba 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/ReactiveZSetOperationsExtensionsUnitTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensionsUnitTests.kt b/src/test/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensionsUnitTests.kt index 219c1ace31..dc40354c98 100644 --- a/src/test/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensionsUnitTests.kt +++ b/src/test/kotlin/org/springframework/data/redis/core/script/RedisScriptExtensionsUnitTests.kt @@ -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.