diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index e01250f688..113cc85066 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -#Wed Oct 04 16:58:12 PDT 2023 -distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip +#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 diff --git a/Jenkinsfile b/Jenkinsfile index 50c3b81adb..4ce7abdfee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,6 +40,26 @@ pipeline { } } } + stage('Publish JDK 17 + Redis 7.2 Docker Image') { + when { + anyOf { + changeset "ci/openjdk17-redis-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-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 .") + docker.withRegistry(p['docker.registry'], p['docker.credentials']) { + image.push() + } + } + } + } stage('Publish JDK 21 + Redis 6.2 Docker Image') { when { anyOf { @@ -83,7 +103,7 @@ pipeline { 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 ci/test.sh' + sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" } } } @@ -111,7 +131,7 @@ pipeline { 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 ci/test.sh' + sh "PROFILE=runtimehints LONG_TESTS=false JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" } } } @@ -129,7 +149,25 @@ pipeline { 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 ci/test.sh' + sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" + } + } + } + } + stage("test: Redis 7") { + agent { + label 'data' + } + 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" } } } @@ -159,18 +197,18 @@ pipeline { steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) { - sh 'MAVEN_OPTS="-Duser.name=spring-builds+jenkins -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=https://repo.spring.io ' + + 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=libs-snapshot-local " + + "-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " + "-Dartifactory.build-name=spring-data-redis " + - "-Dartifactory.build-number=${BUILD_NUMBER} " + - '-Dmaven.test.skip=true clean deploy -U -B' + "-Dartifactory.build-number=spring-data-redis-${BRANCH_NAME}-build-${BUILD_NUMBER} " + + "-Dmaven.test.skip=true clean deploy -U -B" } } } diff --git a/Makefile b/Makefile index c2e53085fe..35334f506d 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -REDIS_VERSION:=6.2.6 +REDIS_VERSION:=7.2.4 SPRING_PROFILE?=ci SHELL=/bin/bash -euo pipefail @@ -175,7 +175,7 @@ clobber: work/redis/bin/redis-cli work/redis/bin/redis-server: @mkdir -p work/redis - curl -sSL https://github.com/antirez/redis/archive/$(REDIS_VERSION).tar.gz | tar xzf - -C work + 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) @@ -196,14 +196,14 @@ stop: redis-stop sentinel-stop cluster-stop test: $(MAKE) start sleep 1 - ./mvnw clean test -U -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1) + ./mvnw clean test -U -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1) $(MAKE) stop $(MAKE) clean all-tests: $(MAKE) start sleep 1 - ./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1) + ./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1) $(MAKE) stop $(MAKE) clean diff --git a/README.adoc b/README.adoc index c89a313d2c..72089cab87 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ 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-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Gradle Enterprise", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Redis"] += 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 Data Redis"] 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. @@ -11,9 +11,9 @@ This modules provides integration with the https://redis.io/[Redis] store. * Connection package as low-level abstraction across multiple Redis drivers (https://github.com/lettuce-io/lettuce-core[Lettuce] and https://github.com/redis/jedis[Jedis]). * Exception translation to Spring’s portable Data Access exception hierarchy for Redis driver exceptions -* https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#redis:template[`RedisTemplate`] that provides a high level abstraction for performing various Redis operations, exception translation and serialization support. +* https://docs.spring.io/spring-data/redis/reference/redis/template.html[`RedisTemplate`] that provides a high level abstraction for performing various Redis operations, exception translation and serialization support. * Pubsub support (such as a MessageListenerContainer for message-driven POJOs). -* https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#redis:sentinel[Redis Sentinel] and https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#cluster[Redis Cluster] support. +* https://docs.spring.io/spring-data/redis/reference/redis/connection-modes.html#redis:sentinel[Redis Sentinel] and https://docs.spring.io/spring-data/redis/reference/redis/connection-modes.html#cluster.enable[Redis Cluster] support. * Reactive API using the Lettuce driver. * JDK, String, JSON and Spring Object/XML mapping serializers. * JDK Collection implementations on top of Redis. @@ -97,7 +97,7 @@ If you'd rather like the latest snapshots of the upcoming major version, use our Having trouble with Spring Data? We’d love to help! * Check the -https://docs.spring.io/spring-data/redis/docs/reference/[reference documentation], and https://docs.spring.io/spring-data/redis/docs/current/api/[Javadocs]. +https://docs.spring.io/spring-data/redis/reference/[reference documentation], and https://docs.spring.io/spring-data/redis/docs/current/api/[Javadocs]. * Learn the Spring basics – Spring Data builds on Spring Framework, check the https://spring.io[spring.io] web-site for a wealth of reference documentation. If you are just starting out with Spring, try one of the https://spring.io/guides[guides]. * If you are upgrading, check out the https://github.com/spring-projects/spring-data-commons/wiki#release-notes[Release notes] for "`new and noteworthy`" features. diff --git a/ci/openjdk17-redis-7.2/Dockerfile b/ci/openjdk17-redis-7.2/Dockerfile new file mode 100644 index 0000000000..6251772188 --- /dev/null +++ b/ci/openjdk17-redis-7.2/Dockerfile @@ -0,0 +1,17 @@ +ARG BASE +FROM ${BASE} +# Any ARG statements before FROM are cleared. +ARG REDIS +ENV REDIS_VERSION=${REDIS} + +# 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 ; \ + apt-get update ; \ + apt-get install -y build-essential ; \ + make work/redis/bin/redis-cli work/redis/bin/redis-server REDIS_VERSION=${REDIS}; \ + 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 d65c9db587..6ff93899b4 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -1,6 +1,6 @@ # Java versions -java.main.tag=17.0.8_7-jdk-focal -java.next.tag=21_35-jdk-jammy +java.main.tag=17.0.9_9-jdk-focal +java.next.tag=21.0.1_12-jdk-jammy # Docker container images - standard docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag} @@ -14,6 +14,7 @@ docker.mongodb.7.0.version=7.0.2 # Supported versions of Redis docker.redis.6.version=6.2.13 +docker.redis.7.version=7.2.4 # Supported versions of Cassandra docker.cassandra.3.version=3.11.16 @@ -26,5 +27,8 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock - docker.registry= docker.credentials=hub.docker.com-springbuildmaster 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 445a65fa5f..06db99ec5d 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -12,12 +12,13 @@ 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=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B +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 # Capture resulting exit code from maven (pass/fail) RESULT=$? diff --git a/pom.xml b/pom.xml index da45839e46..507b76dd15 100644 --- a/pom.xml +++ b/pom.xml @@ -24,10 +24,10 @@ 1.9.4 1.4.20 2.11.1 - 6.3.0.RELEASE + 6.3.2.RELEASE 5.0.2 1.01 - 4.1.100.Final + 4.1.107.Final spring.data.redis @@ -297,6 +297,11 @@ org.apache.maven.plugins maven-surefire-plugin + + ${redis.server.version} + ${lettuce} + ${jedis} + -XX:-OmitStackTraceInFastThrow false diff --git a/src/main/antora/modules/ROOT/pages/redis/cluster.adoc b/src/main/antora/modules/ROOT/pages/redis/cluster.adoc index dfb91f1a05..2dda2c0b94 100644 --- a/src/main/antora/modules/ROOT/pages/redis/cluster.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/cluster.adoc @@ -6,6 +6,10 @@ See the https://redis.io/topics/cluster-tutorial[Cluster Tutorial] for more info NOTE: When using xref:repositories.adoc[Redis Repositories] with Redis Cluster, make yourself familiar with how to xref:redis/redis-repositories/cluster.adoc[run Redis Repositories on a Cluster]. +CAUTION: Do not rely on keyspace events when using Redis Cluster as keyspace events are not replicated across shards. +Pub/Sub https://github.com/spring-projects/spring-data-redis/issues/1111[subscribes to a random cluster node] which only receives keyspace events from a single shard. +Use single-node Redis to avoid keyspace event loss. + [[cluster.working.with.cluster]] == Working With Redis Cluster Connection @@ -33,8 +37,8 @@ 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-10922 <2> -164888... 127.0.0.1:7381 master - 0 1449730618304 3 connected 10923-16383 <3> +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> b8b5ee... 127.0.0.1:7382 slave 6b38bb... 0 1449730618304 25 connected <4> ---- @@ -129,3 +133,6 @@ 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`. +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 cc010e7cf8..062eb33d06 100644 --- a/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/connection-modes.adoc @@ -96,13 +96,16 @@ public RedisConnectionFactory jedisConnectionFactory() { [TIP] ==== -`RedisSentinelConfiguration` can also be defined with a `PropertySource`, which lets you set the following properties: +`RedisSentinelConfiguration` can also be defined through `RedisSentinelConfiguration.of(PropertySource)`, which lets you pick up the following properties: .Configuration Properties * `spring.redis.sentinel.master`: name of the master node. * `spring.redis.sentinel.nodes`: Comma delimited list of host:port pairs. * `spring.redis.sentinel.username`: The username to apply when authenticating with Redis Sentinel (requires Redis 6) * `spring.redis.sentinel.password`: The password to apply when authenticating with Redis Sentinel +* `spring.redis.sentinel.dataNode.username`: The username to apply when authenticating with Redis Data Node +* `spring.redis.sentinel.dataNode.password`: The password to apply when authenticating with Redis Data Node +* `spring.redis.sentinel.dataNode.database`: The database index to apply when authenticating with Redis Data Node ==== Sometimes, direct interaction with one of the Sentinels is required. Using `RedisConnectionFactory.getSentinelConnection()` or `RedisConnection.getSentinelCommands()` gives you access to the first active Sentinel configured. @@ -161,7 +164,7 @@ public class AppConfig { [TIP] ==== -`RedisClusterConfiguration` can also be defined through `PropertySource` and has the following properties: +`RedisClusterConfiguration` can also be defined through `RedisClusterConfiguration.of(PropertySource)`, which lets you pick up the following properties: .Configuration Properties - `spring.redis.cluster.nodes`: Comma-delimited list of host:port pairs. diff --git a/src/main/antora/modules/ROOT/pages/redis/drivers.adoc b/src/main/antora/modules/ROOT/pages/redis/drivers.adoc index 068c7d7e3f..2f649f3166 100644 --- a/src/main/antora/modules/ROOT/pages/redis/drivers.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/drivers.adoc @@ -89,7 +89,7 @@ The following overview explains features that are supported by the individual Re | Datatype support | Key, String, List, Set, Sorted Set, Hash, Server, Stream, Scripting, Geo, HyperLogLog -| Key, String, List, Set, Sorted Set, Hash, Server, Scripting, Geo, HyperLogLog +| Key, String, List, Set, Sorted Set, Hash, Server, Stream, Scripting, Geo, HyperLogLog | Reactive (non-blocking) API | X 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 b0828633c3..2ecbc321b7 100644 --- a/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/hash-mappers.adoc @@ -31,7 +31,7 @@ public class Person { public class HashMapping { - @Autowired + @Resource(name = "redisTemplate") HashOperations hashOperations; HashMapper mapper = new ObjectHashMapper(); @@ -44,7 +44,7 @@ public class HashMapping { public Person loadHash(String key) { - Map loadedHash = hashOperations.entries("key"); + Map loadedHash = hashOperations.entries(key); return (Person) mapper.fromHash(loadedHash); } } diff --git a/src/main/antora/modules/ROOT/pages/redis/pipelining.adoc b/src/main/antora/modules/ROOT/pages/redis/pipelining.adoc index 8a4d70665a..7e5ddd0541 100644 --- a/src/main/antora/modules/ROOT/pages/redis/pipelining.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/pipelining.adoc @@ -20,7 +20,9 @@ List results = stringRedisTemplate.executePipelined( }); ---- -The preceding example runs a bulk right pop of items from a queue in a pipeline. The `results` `List` contains all of the popped items. `RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results before returning, so the returned items in the preceding example are Strings. There are additional `executePipelined` methods that let you pass a custom serializer for pipelined results. +The preceding example runs a bulk right pop of items from a queue in a pipeline. +The `results` `List` contains all the popped items. `RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results before returning, so the returned items in the preceding example are Strings. +There are additional `executePipelined` methods that let you pass a custom serializer for pipelined results. Note that the value returned from the `RedisCallback` is required to be `null`, as this value is discarded in favor of returning the results of the pipelined commands. @@ -35,3 +37,7 @@ factory.setPipeliningFlushPolicy(PipeliningFlushPolicy.buffered(3)); <1> ---- <1> Buffer locally and flush after every 3rd command. ==== + +NOTE: Pipelining is limited to Redis Standalone. +Redis Cluster 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/redis-cache.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc index 6491531dd3..c965f352a9 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-cache.adoc @@ -61,7 +61,7 @@ The following example shows how to set a static prefix: [source,java] ---- // static key prefix -RedisCacheConfiguration.defaultCacheConfig().prefixKeysWith("(͡° ᴥ ͡°)"); +RedisCacheConfiguration.defaultCacheConfig().prefixCacheNameWith("(͡° ᴥ ͡°)"); The following example shows how to set a computed prefix: @@ -234,13 +234,13 @@ Of course, you can combine both global and per-cache configuration using: ---- RedisCacheConfiguration predefined = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(MyCustomTtlFunction.INSTANCE)); + .entryTtl(MyCustomTtlFunction.INSTANCE); -Map initialCaches = Collections.singletonMap("predefined",predefined); +Map initialCaches = Collections.singletonMap("predefined", predefined); RedisCacheManager cacheManager = RedisCacheManager.builder(redisConnectionFactory) .cacheDefaults(fiveMinuteTtlExpirationDefaults) - .withInitialCacheConfiguration() + .withInitialCacheConfigurations(initialCaches) .build(); ---- diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/indexes.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/indexes.adoc index 327a257b4d..228f8e92f4 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/indexes.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/indexes.adoc @@ -56,8 +56,8 @@ public class Person { // ... other properties omitted - Map attributes; <1> - Map relatives; <2> + Map attributes; <1> + Map relatives; <2> List
addresses; <3> } ---- @@ -157,7 +157,7 @@ rand.setAddress(new Address(new Point(13.361389D, 38.115556D))); repository.save(rand); <3> -repository.findByAddressLocationNear(new Point(15D, 37D), new Distance(200)); <4> +repository.findByAddressLocationNear(new Point(15D, 37D), new Distance(200, Metrics.KILOMETERS)); <4> ---- <1> Query method declaration on a nested property, using `Point` and `Distance`. diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc index a3415b6d26..fb1a08c0f8 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc @@ -77,7 +77,7 @@ addresses.[work].city = "... CAUTION: Due to the flat representation structure, Map keys need to be simple types, such as ``String`` or ``Number``. Mapping behavior can be customized by registering the corresponding `Converter` in `RedisCustomConversions`. -Those converters can take care of converting from and to a single `byte[]` as well as `Map`. +Those converters can take care of converting from and to a single `byte[]` as well as `Map`. The first one is suitable for (for example) converting a complex type to (for example) a binary JSON representation that still uses the default mappings hash structure. The second option offers full control over the resulting hash. @@ -140,15 +140,15 @@ address = { city : "emond's field", country : "andor" } The following example shows two examples of `Map` converters: -.Sample Map Converters +.Sample Map Converters ==== [source,java] ---- @WritingConverter -public class AddressToMapConverter implements Converter> { +public class AddressToMapConverter implements Converter> { @Override - public Map convert(Address source) { + public Map convert(Address source) { return singletonMap("ciudad", source.getCity().getBytes()); } } @@ -157,7 +157,7 @@ public class AddressToMapConverter implements Converter, Address> { @Override - public Address convert(Map source) { + public Address convert(Map source) { return new Address(new String(source.get("ciudad"))); } } diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/query-by-example.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/query-by-example.adoc index 4b90baeb04..e12b6eb6db 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/query-by-example.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/query-by-example.adoc @@ -9,7 +9,7 @@ The following example uses Query by Example against a repository: ==== [source, java] ---- -interface PersonRepository extends QueryByExampleExecutor { +interface PersonRepository extends ListQueryByExampleExecutor { } class PersonService { 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 4a596b88e3..ca6a9c41b1 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-4475-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-2024-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 b6fe510c79..97febc2cee 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-streams.adoc @@ -32,7 +32,7 @@ con.xAdd(record); // append message through RedisTemplate RedisTemplate template = … StringRecord record = StreamRecords.string(…).withStreamKey("my-stream"); -template.streamOps().add(record); +template.opsForStream().add(record); ---- Stream records carry a `Map`, key-value tuples, as their payload. Appending a record to a stream returns the `RecordId` that can be used as further reference. @@ -58,10 +58,10 @@ While stream consumption is typically associated with asynchronous processing, i // Read message through RedisTemplate RedisTemplate template = … -List> messages = template.streamOps().read(StreamReadOptions.empty().count(2), +List> messages = template.opsForStream().read(StreamReadOptions.empty().count(2), StreamOffset.latest("my-stream")); -List> messages = template.streamOps().read(Consumer.from("my-group", "my-consumer"), +List> messages = template.opsForStream().read(Consumer.from("my-group", "my-consumer"), StreamReadOptions.empty().count(2), StreamOffset.create("my-stream", ReadOffset.lastConsumed())) ---- diff --git a/src/main/antora/modules/ROOT/pages/redis/template.adoc b/src/main/antora/modules/ROOT/pages/redis/template.adoc index 6eb576c0cc..38dd0d42e9 100644 --- a/src/main/antora/modules/ROOT/pages/redis/template.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/template.adoc @@ -140,7 +140,7 @@ class MyConfig { RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) { RedisTemplate template = new RedisTemplate<>(); - template.setConnectionFactory(redisConnectionFactory); + template.setConnectionFactory(connectionFactory); return template; } } diff --git a/src/main/antora/modules/ROOT/pages/redis/transactions.adoc b/src/main/antora/modules/ROOT/pages/redis/transactions.adoc index c8b8720888..de48a55cc5 100644 --- a/src/main/antora/modules/ROOT/pages/redis/transactions.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/transactions.adoc @@ -25,6 +25,28 @@ System.out.println("Number of items added to set: " + txResults.get(0)); `RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results of `exec` before returning. There is an additional `exec` method that lets you pass a custom serializer for transaction results. +It is worth mentioning that in case between `multi()` and `exec()` an exception happens (e.g. a timeout exception in case Redis does not respond within the timeout) then the connection may get stuck in a transactional state. +To prevent such a situation need have to discard the transactional state to clear the connection: + +[source,java] +---- +List txResults = redisOperations.execute(new SessionCallback>() { + public List execute(RedisOperations operations) throws DataAccessException { + boolean transactionStateIsActive = true; + try { + operations.multi(); + operations.opsForSet().add("key", "value1"); + + // This will contain the results of all operations in the transaction + return operations.exec(); + } catch (RuntimeException e) { + operations.discard(); + throw e; + } + } +}); +---- + [[tx.spring]] == `@Transactional` Support diff --git a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc index 875f61abeb..1fae30fda5 100644 --- a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc +++ b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc @@ -1,4 +1,4 @@ -[[cassandra.projections]] +[[redis.projections]] = Projections include::{commons}@data-commons::page$repositories/projections.adoc[leveloffset=+1] diff --git a/src/main/antora/resources/antora-resources/antora.yml b/src/main/antora/resources/antora-resources/antora.yml index e7bda9ab58..10dd13d032 100644 --- a/src/main/antora/resources/antora-resources/antora.yml +++ b/src/main/antora/resources/antora-resources/antora.yml @@ -12,7 +12,7 @@ asciidoc: lettuce: ${lettuce} jedis: ${jedis} include-xml-namespaces: false - spring-data-commons-docs-url: https://docs.spring.io/spring-data-commons/reference + spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference spring-data-commons-javadoc-base: https://docs.spring.io/spring-data/commons/docs/${springdata.commons}/api/ springdocsurl: https://docs.spring.io/spring-framework/reference/{springversionshort} springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api diff --git a/src/main/java/org/springframework/data/redis/ClusterRedirectException.java b/src/main/java/org/springframework/data/redis/ClusterRedirectException.java index bfe3ea3e2f..79a5f0632d 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-2023 the original author or authors. + * Copyright 2015-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. diff --git a/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java b/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java index 6c3526139b..61ccabde15 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-2023 the original author or authors. + * Copyright 2015-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. diff --git a/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java index 344e4af52a..d5c34e9cdb 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-2023 the original author or authors. + * Copyright 2014-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. diff --git a/src/main/java/org/springframework/data/redis/FallbackExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/FallbackExceptionTranslationStrategy.java index 257923b15c..ed9728797f 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-2023 the original author or authors. + * Copyright 2014-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. diff --git a/src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.java b/src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.java index 2e792f33a3..aa4aeee609 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-2023 the original author or authors. + * Copyright 2014-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. diff --git a/src/main/java/org/springframework/data/redis/RedisConnectionFailureException.java b/src/main/java/org/springframework/data/redis/RedisConnectionFailureException.java index d3679f4966..73d4fe2045 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/main/java/org/springframework/data/redis/RedisSystemException.java b/src/main/java/org/springframework/data/redis/RedisSystemException.java index de12403c6c..50d2218dd3 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java b/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java index 7e21e722db..6a40b28f00 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-2023 the original author or authors. + * Copyright 2015-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. 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 639d1906ba..0649d513e6 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-2023 the original author or authors. + * Copyright 2022-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. @@ -35,6 +35,7 @@ import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.connection.*; import org.springframework.data.redis.core.*; +import org.springframework.data.redis.core.RedisConnectionUtils.RedisConnectionProxy; import org.springframework.data.redis.core.convert.KeyspaceConfiguration; import org.springframework.data.redis.core.convert.MappingConfiguration; import org.springframework.data.redis.core.convert.MappingRedisConverter; @@ -46,6 +47,7 @@ import org.springframework.data.redis.core.index.IndexConfiguration; import org.springframework.data.redis.core.mapping.RedisMappingContext; import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.repository.query.RedisPartTreeQuery; import org.springframework.data.redis.repository.query.RedisQueryCreator; import org.springframework.data.redis.repository.support.RedisRepositoryFactoryBean; import org.springframework.lang.Nullable; @@ -106,15 +108,15 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) TypeReference.of(ReactiveClusterScriptingCommands.class), TypeReference.of(ReactiveClusterGeoCommands.class), TypeReference.of(ReactiveClusterHyperLogLogCommands.class), TypeReference.of(ReactiveRedisOperations.class), - TypeReference.of(ReactiveRedisConnectionFactory.class), - TypeReference.of(ReactiveRedisTemplate.class), TypeReference.of(RedisOperations.class), - TypeReference.of(RedisTemplate.class), TypeReference.of(StringRedisTemplate.class), - TypeReference.of(KeyspaceConfiguration.class), TypeReference.of(MappingConfiguration.class), - TypeReference.of(MappingRedisConverter.class), TypeReference.of(RedisConverter.class), - TypeReference.of(RedisCustomConversions.class), TypeReference.of(ReferenceResolver.class), - TypeReference.of(ReferenceResolverImpl.class), TypeReference.of(IndexConfiguration.class), - TypeReference.of(ConfigurableIndexDefinitionProvider.class), TypeReference.of(RedisMappingContext.class), - TypeReference.of(RedisRepositoryFactoryBean.class), TypeReference.of(RedisQueryCreator.class), + TypeReference.of(ReactiveRedisConnectionFactory.class), TypeReference.of(ReactiveRedisTemplate.class), + TypeReference.of(RedisOperations.class), TypeReference.of(RedisTemplate.class), + TypeReference.of(StringRedisTemplate.class), TypeReference.of(KeyspaceConfiguration.class), + TypeReference.of(MappingConfiguration.class), TypeReference.of(MappingRedisConverter.class), + TypeReference.of(RedisConverter.class), TypeReference.of(RedisCustomConversions.class), + TypeReference.of(ReferenceResolver.class), TypeReference.of(ReferenceResolverImpl.class), + TypeReference.of(IndexConfiguration.class), TypeReference.of(ConfigurableIndexDefinitionProvider.class), + TypeReference.of(RedisMappingContext.class), TypeReference.of(RedisRepositoryFactoryBean.class), + TypeReference.of(RedisQueryCreator.class), TypeReference.of(RedisPartTreeQuery.class), TypeReference.of(MessageListener.class), TypeReference.of(RedisMessageListenerContainer.class), TypeReference @@ -156,6 +158,20 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) boundOperationsProxy(BoundStreamOperations.class, classLoader, hints); boundOperationsProxy(BoundValueOperations.class, classLoader, hints); boundOperationsProxy(BoundZSetOperations.class, classLoader, hints); + + // Connection Splitting + registerRedisConnectionProxy(TypeReference.of(RedisCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisGeoCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisHashCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisHyperLogLogCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisKeyCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisListCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisSetCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisScriptingCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisServerCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisStreamCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisStringCommands.class), hints); + registerRedisConnectionProxy(TypeReference.of(RedisZSetCommands.class), hints); } static void boundOperationsProxy(Class type, ClassLoader classLoader, RuntimeHints hints) { @@ -178,4 +194,13 @@ static void boundOperationsProxy(TypeReference typeReference, ClassLoader classL TypeReference.of("org.springframework.aop.framework.Advised"), // TypeReference.of("org.springframework.core.DecoratingProxy")); } + + static void registerRedisConnectionProxy(TypeReference typeReference, RuntimeHints hints) { + + hints.proxies().registerJdkProxy(TypeReference.of(RedisConnectionProxy.class), // + typeReference, // + TypeReference.of("org.springframework.aop.SpringProxy"), // + TypeReference.of("org.springframework.aop.framework.Advised"), // + TypeReference.of("org.springframework.core.DecoratingProxy")); + } } 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 fa4c78e865..047ef3834c 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-2023 the original author or authors. + * Copyright 2021-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. 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 a1abaacd7e..d18db54c9a 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-2023 the original author or authors. + * Copyright 2021-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. 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 4947350b33..a08003f2d2 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-2023 the original author or authors. + * Copyright 2018-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. 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 665a262040..d69d768508 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-2023 the original author or authors. + * Copyright 2020-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. 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 f5e5ad0381..24b5eff794 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-2023 the original author or authors. + * Copyright 2020-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. 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 b0c342aa3d..b7566f4212 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-2023 the original author or authors. + * Copyright 2020-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. 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 d89663f5ea..6a8d5b7620 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-2023 the original author or authors. + * Copyright 2020-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. 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 5d997bee42..205487fa1b 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-2023 the original author or authors. + * 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. @@ -32,6 +32,7 @@ import org.springframework.data.redis.connection.ReactiveStringCommands; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStringCommands; import org.springframework.data.redis.connection.RedisStringCommands.SetOption; import org.springframework.data.redis.core.types.Expiration; import org.springframework.data.redis.util.ByteUtils; @@ -57,6 +58,7 @@ * @author Mark Paluch * @author André Prata * @author John Blum + * @author ChanYoung Joung * @since 2.0 */ class DefaultRedisCacheWriter implements RedisCacheWriter { @@ -218,8 +220,10 @@ public byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Durat return execute(name, connection -> { + boolean wasLocked = false; if (isLockingCacheWriter()) { doLock(name, key, value, connection); + wasLocked = true; } try { @@ -241,7 +245,7 @@ public byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Durat return connection.stringCommands().get(key); } finally { - if (isLockingCacheWriter()) { + if (isLockingCacheWriter() && wasLocked) { doUnlock(name, connection); } } @@ -318,13 +322,18 @@ void lock(String name) { execute(name, connection -> doLock(name, name, null, connection)); } - @Nullable - private Boolean doLock(String name, Object contextualKey, @Nullable Object contextualValue, - RedisConnection connection) { + boolean doLock(String name, Object contextualKey, @Nullable Object contextualValue, RedisConnection connection) { + RedisStringCommands commands = connection.stringCommands(); Expiration expiration = Expiration.from(this.lockTtl.getTimeToLive(contextualKey, contextualValue)); + byte[] cacheLockKey = createCacheLockKey(name); - return connection.stringCommands().set(createCacheLockKey(name), new byte[0], expiration, SetOption.SET_IF_ABSENT); + while (!ObjectUtils.nullSafeEquals(commands.set(cacheLockKey, new byte[0], expiration, SetOption.SET_IF_ABSENT), + true)) { + checkAndPotentiallyWaitUntilUnlocked(name, connection); + } + + return true; } /** @@ -337,7 +346,7 @@ void unlock(String name) { } @Nullable - private Long doUnlock(String name, RedisConnection connection) { + Long doUnlock(String name, RedisConnection connection) { return connection.keyCommands().del(createCacheLockKey(name)); } @@ -485,8 +494,7 @@ public CompletableFuture retrieve(String name, byte[] key, @Nullable Dur Mono cacheLockCheck = isLockingCacheWriter() ? waitForLock(connection, name) : Mono.empty(); ReactiveStringCommands stringCommands = connection.stringCommands(); - Mono get = shouldExpireWithin(ttl) - ? stringCommands.getEx(wrappedKey, Expiration.from(ttl)) + Mono get = shouldExpireWithin(ttl) ? stringCommands.getEx(wrappedKey, Expiration.from(ttl)) : stringCommands.get(wrappedKey); return cacheLockCheck.then(get).map(ByteUtils::getBytes).toFuture(); @@ -498,8 +506,7 @@ public CompletableFuture store(String name, byte[] key, byte[] value, @Nul return doWithConnection(connection -> { - Mono mono = isLockingCacheWriter() - ? doStoreWithLocking(name, key, value, ttl, connection) + Mono mono = isLockingCacheWriter() ? doStoreWithLocking(name, key, value, ttl, connection) : doStore(key, value, ttl, connection); return mono.then().toFuture(); @@ -527,7 +534,6 @@ private Mono doStore(byte[] cacheKey, byte[] value, @Nullable Duration } } - private Mono doLock(String name, Object contextualKey, @Nullable Object contextualValue, ReactiveRedisConnection connection) { 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 04c6360949..e0a328e878 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 the original author or authors. + * Copyright 2023-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. 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 18cdcc3fff..a783da8c8f 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-2023 the original author or authors. + * Copyright 2020-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. 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 77a6dc8246..498ff82679 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-2023 the original author or authors. + * Copyright 2020-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. 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 11debd8710..187add2512 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-2023 the original author or authors. + * 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. @@ -62,8 +62,7 @@ public class RedisCache extends AbstractValueAdaptingCache { static final byte[] BINARY_NULL_VALUE = RedisSerializer.java().serialize(NullValue.INSTANCE); - static final String CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE = - "The Redis driver configured with RedisCache through RedisCacheWriter does not support CompletableFuture-based retrieval"; + static final String CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE = "The Redis driver configured with RedisCache through RedisCacheWriter does not support CompletableFuture-based retrieval"; private final Lock lock = new ReentrantLock(); @@ -74,16 +73,16 @@ public class RedisCache extends AbstractValueAdaptingCache { private final String name; /** - * Create a new {@link RedisCache} with the given {@link String name} and {@link RedisCacheConfiguration}, - * using the {@link RedisCacheWriter} to execute Redis commands supporting the cache operations. + * Create a new {@link RedisCache} with the given {@link String name} and {@link RedisCacheConfiguration}, using the + * {@link RedisCacheWriter} to execute Redis commands supporting the cache operations. * * @param name {@link String name} for this {@link Cache}; must not be {@literal null}. - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing the necessary Redis commands; must not be {@literal null}. - * @param cacheConfiguration {@link RedisCacheConfiguration} applied to this {@link RedisCache} on creation; - * must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing the + * necessary Redis commands; must not be {@literal null}. + * @param cacheConfiguration {@link RedisCacheConfiguration} applied to this {@link RedisCache} on creation; must not + * be {@literal null}. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null} or the given {@link String} name for this {@link RedisCache} is {@literal null}. + * are {@literal null} or the given {@link String} name for this {@link RedisCache} is {@literal null}. */ protected RedisCache(String name, RedisCacheWriter cacheWriter, RedisCacheConfiguration cacheConfiguration) { @@ -117,11 +116,11 @@ protected RedisCacheWriter getCacheWriter() { } /** - * Gets the configured {@link ConversionService} used to convert {@link Object cache keys} to a {@link String} - * when accessing entries in the cache. + * Gets the configured {@link ConversionService} used to convert {@link Object cache keys} to a {@link String} when + * accessing entries in the cache. * - * @return the configured {@link ConversionService} used to convert {@link Object cache keys} to a {@link String} - * when accessing entries in the cache. + * @return the configured {@link ConversionService} used to convert {@link Object cache keys} to a {@link String} when + * accessing entries in the cache. * @see RedisCacheConfiguration#getConversionService() * @see #getCacheConfiguration() */ @@ -175,8 +174,8 @@ private T getSynchronized(Object key, Callable valueLoader) { } /** - * Loads the {@link Object} using the given {@link Callable valueLoader} and {@link #put(Object, Object) puts} - * the {@link Object loaded value} in the cache. + * Loads the {@link Object} using the given {@link Callable valueLoader} and {@link #put(Object, Object) puts} the + * {@link Object loaded value} in the cache. * * @param {@link Class type} of the loaded {@link Object cache value}. * @param key {@link Object key} mapped to the loaded {@link Object cache value}. @@ -281,27 +280,23 @@ public void evict(Object key) { } @Override - public CompletableFuture retrieve(Object key) { + public CompletableFuture retrieve(Object key) { if (!getCacheWriter().supportsAsyncRetrieve()) { throw new UnsupportedOperationException(CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE); } - return retrieveValue(key).thenApply(this::nullSafeDeserializedStoreValue); + return retrieveValue(key); } @Override @SuppressWarnings("unchecked") public CompletableFuture retrieve(Object key, Supplier> valueLoader) { - if (!getCacheWriter().supportsAsyncRetrieve()) { - throw new UnsupportedOperationException(CACHE_RETRIEVAL_UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE); - } - - return retrieveValue(key).thenCompose(bytes -> { + return retrieve(key).thenCompose(wrapper -> { - if (bytes != null) { - return CompletableFuture.completedFuture((T) nullSafeDeserializedStoreValue(bytes)); + if (wrapper != null) { + return CompletableFuture.completedFuture((T) wrapper.get()); } return valueLoader.get().thenCompose(value -> { @@ -313,8 +308,7 @@ public CompletableFuture retrieve(Object key, Supplier value); + return getCacheWriter().store(getName(), binaryKey, binaryValue, timeToLive).thenApply(v -> value); }); }); } @@ -440,15 +434,18 @@ 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()'", + 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); } - private CompletableFuture retrieveValue(Object key) { - return getCacheWriter().retrieve(getName(), createAndConvertCacheKey(key)); + private CompletableFuture retrieveValue(Object key) { + return getCacheWriter().retrieve(getName(), createAndConvertCacheKey(key)) // + .thenApply(binaryValue -> binaryValue != null ? deserializeCacheValue(binaryValue) : null) // + .thenApply(this::toValueWrapper); } @Nullable 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 202ddee446..261c932ab2 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-2023 the original author or authors. + * 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. 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 ffd4dafa1e..1df8208ef4 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-2023 the original author or authors. + * 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. 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 f9dc937fa9..04dd0e3507 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-2023 the original author or authors. + * 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. 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 65f21de3ed..6e5963eb9f 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-2023 the original author or authors. + * Copyright 2011-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. 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 afe1b23bcb..7c09a8896d 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-2023 the original author or authors. + * Copyright 2011-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. 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 12cdc819ad..256dba0ffd 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-2023 the original author or authors. + * Copyright 2011-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. 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 fcdffc4a38..7b2581973d 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-2023 the original author or authors. + * Copyright 2014-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. 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 9c624a8b1c..bb24d05634 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-2023 the original author or authors. + * Copyright 2018-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. 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 d71b2805e0..7a786b63f9 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-2023 the original author or authors. + * Copyright 2015-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. 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 0b28fbd05c..3e896e53d9 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-2023 the original author or authors. + * Copyright 2015-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. 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 46a3401f51..e09ebbfd8d 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-2023 the original author or authors. + * Copyright 2015-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. 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 8d829468e7..454ac41d23 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-2023 the original author or authors. + * Copyright 2015-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. 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 f9448e65f1..6494f423c7 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-2023 the original author or authors. + * Copyright 2015-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. 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 f49236b188..bb82facae2 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-2023 the original author or authors. + * Copyright 2015-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. 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 a97c5ef4bb..22827c1d2b 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-2023 the original author or authors. + * Copyright 2015-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. 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 06e3607e5a..9c768307f4 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-2023 the original author or authors. + * Copyright 2011-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. 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 911859afe4..746eb09a9b 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-2023 the original author or authors. + * Copyright 2011-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. 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 5d001c880f..2757810c0e 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-2023 the original author or authors. + * Copyright 2016-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. 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 d6616f0295..0ec00955e9 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-2023 the original author or authors. + * Copyright 2011-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. 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 595f3599aa..44526bd999 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-2023 the original author or authors. + * Copyright 2011-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. 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 857f430e2f..80cc128e55 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-2023 the original author or authors. + * Copyright 2011-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. 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 962745e078..7851a0f2a8 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-2023 the original author or authors. + * Copyright 2011-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. 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 5749f06278..dfa5986df5 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-2023 the original author or authors. + * 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. 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 26190f114f..aaeaafe18b 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-2023 the original author or authors. + * 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. 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 e869f77147..122e889798 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-2023 the original author or authors. + * Copyright 2013-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. 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 4f0662ba69..f47e2b6747 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-2023 the original author or authors. + * Copyright 2022-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. 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 4e545dba2b..5be91f3897 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-2023 the original author or authors. + * Copyright 2011-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. 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 80e10f3c61..fcf894a413 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-2023 the original author or authors. + * Copyright 2011-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. 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 1e7fda80c0..a638ed5781 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-2023 the original author or authors. + * Copyright 2014-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. 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 a7b99312bb..06969e9ace 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-2023 the original author or authors. + * Copyright 2013-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. 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 6bffc96cd9..da4fad9d76 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-2023 the original author or authors. + * Copyright 2020-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. 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 2d211b0b01..d4496375cd 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-2023 the original author or authors. + * Copyright 2016-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. 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 499a5202fc..60e2390988 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-2023 the original author or authors. + * Copyright 2016-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. 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 370496db24..03df631960 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-2023 the original author or authors. + * Copyright 2016-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. 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 5ede7c1d0a..21aea13ba1 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-2023 the original author or authors. + * Copyright 2016-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. 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 5f66a8585e..ad5bf5a3dc 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-2023 the original author or authors. + * Copyright 2016-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. 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 bdc112e1c3..5968745c1c 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-2023 the original author or authors. + * Copyright 2016-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. 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 033b2d9682..b027421546 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-2023 the original author or authors. + * 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. 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 1782926496..050715b734 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-2023 the original author or authors. + * 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. 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 9a2ba1c364..8590edeab9 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-2023 the original author or authors. + * Copyright 2016-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. 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 804f68df2b..696958fd77 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-2023 the original author or authors. + * Copyright 2018-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. 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 2d5ad9d09a..3800aec877 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-2023 the original author or authors. + * Copyright 2016-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. 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 510e4654cc..f11a90d7cb 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-2023 the original author or authors. + * Copyright 2016-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. 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 f11cacfffe..cbeec12b28 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-2023 the original author or authors. + * Copyright 2016-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. 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 bb6aabe565..063dd6e285 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-2023 the original author or authors. + * Copyright 2016-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. 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 64a0e95493..d10975851a 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-2023 the original author or authors. + * Copyright 2016-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. 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 3367ac18f6..bd3f4d73dd 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-2023 the original author or authors. + * Copyright 2016-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. 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 52c14203eb..f3fbd20f3e 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-2023 the original author or authors. + * Copyright 2016-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. 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 27466bf9bb..bbade90af8 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-2023 the original author or authors. + * Copyright 2016-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. 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 b7ac31609a..d07155b4ab 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-2023 the original author or authors. + * Copyright 2018-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. 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 4e58c0fe9b..2dc4efd081 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-2023 the original author or authors. + * Copyright 2016-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. 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 55af4c6e69..7da6929ad3 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-2023 the original author or authors. + * Copyright 2016-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. 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 203e6a3cca..05e726e753 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-2023 the original author or authors. + * 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. 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 cd3b8e94b0..5337763728 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-2023 the original author or authors. + * 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. 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 90fec5f382..d95b718503 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-2023 the original author or authors. + * 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. 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 bbd242c082..845301dba9 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-2023 the original author or authors. + * Copyright 2016-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. 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 2839d110a1..460a8cc3fe 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-2023 the original author or authors. + * Copyright 2018-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. 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 8e35e3a27a..493b055dae 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-2023 the original author or authors. + * Copyright 2016-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. 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 9a4b7edd80..2929544c97 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-2023 the original author or authors. + * Copyright 2018-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. 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 3822d53b71..2abbb212ce 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-2023 the original author or authors. + * Copyright 2016-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. 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 ad277cb7da..9a47dd7413 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-2023 the original author or authors. + * Copyright 2015-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. 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 befb4ae54c..7427559004 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-2023 the original author or authors. + * Copyright 2022-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. 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 99d670a423..620e132d02 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-2023 the original author or authors. + * Copyright 2015-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. @@ -51,16 +51,14 @@ public class RedisClusterConfiguration implements RedisConfiguration, ClusterCon private RedisPassword password = RedisPassword.none(); - private final Set clusterNodes; + private final Set clusterNodes = new LinkedHashSet<>(); private @Nullable String username = null; /** * Creates a new, default {@link RedisClusterConfiguration}. */ - public RedisClusterConfiguration() { - this(new MapPropertySource("RedisClusterConfiguration", Collections.emptyMap())); - } + public RedisClusterConfiguration() {} /** * Creates a new {@link RedisClusterConfiguration} for given {@link String hostPort} combinations. @@ -75,27 +73,30 @@ public RedisClusterConfiguration() { * @param clusterNodes must not be {@literal null}. */ public RedisClusterConfiguration(Collection clusterNodes) { - this(new MapPropertySource("RedisClusterConfiguration", asMap(clusterNodes, -1))); + initialize(new MapPropertySource("RedisClusterConfiguration", asMap(clusterNodes, -1))); } /** * Creates a new {@link RedisClusterConfiguration} looking up configuration values from the given * {@link PropertySource}. * - *
-	 * 
+	 * 
 	 * spring.redis.cluster.nodes=127.0.0.1:23679,127.0.0.1:23680,127.0.0.1:23681
 	 * spring.redis.cluster.max-redirects=3
-	 * 
 	 * 
* * @param propertySource must not be {@literal null}. + * @deprecated since 3.3, use {@link RedisSentinelConfiguration#of(PropertySource)} instead. This constructor will be + * made private in the next major release. */ + @Deprecated(since = "3.3") public RedisClusterConfiguration(PropertySource propertySource) { + initialize(propertySource); + } - Assert.notNull(propertySource, "PropertySource must not be null"); + private void initialize(PropertySource propertySource) { - this.clusterNodes = new LinkedHashSet<>(); + Assert.notNull(propertySource, "PropertySource must not be null"); if (propertySource.containsProperty(REDIS_CLUSTER_NODES_CONFIG_PROPERTY)) { @@ -109,6 +110,23 @@ public RedisClusterConfiguration(PropertySource propertySource) { } } + /** + * Creates a new {@link RedisClusterConfiguration} looking up configuration values from the given + * {@link PropertySource}. + * + *
+	 * spring.redis.cluster.nodes=127.0.0.1:23679,127.0.0.1:23680,127.0.0.1:23681
+	 * spring.redis.cluster.max-redirects=3
+	 * 
+ * + * @param propertySource must not be {@literal null}. + * @return a new {@link RedisClusterConfiguration} configured from the given {@link PropertySource}. + * @since 3.3 + */ + public static RedisClusterConfiguration of(PropertySource propertySource) { + return new RedisClusterConfiguration(propertySource); + } + private void appendClusterNodes(Set hostAndPorts) { for (String hostAndPort : hostAndPorts) { 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 2ffd7dc2b2..d079fae2f3 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-2023 the original author or authors. + * Copyright 2015-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. 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 acc4fe43da..7f84a2110d 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-2023 the original author or authors. + * Copyright 2015-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. 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 76f06f91c3..0802c5a7ac 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-2023 the original author or authors. + * 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. 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 a185a0ea83..2b60126aad 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-2023 the original author or authors. + * Copyright 2011-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. 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 d06e6fa1b8..0a1c7a18ed 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-2023 the original author or authors. + * Copyright 2022-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. 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 d4f3e98a73..395ccfc85f 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-2023 the original author or authors. + * Copyright 2018-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. 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 b6f8f32ba8..b3021e64ef 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-2023 the original author or authors. + * Copyright 2011-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. 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 1848c20e7d..704da97a77 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-2023 the original author or authors. + * Copyright 2011-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. 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 96b7ce01f9..88f74d8a56 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-2023 the original author or authors. + * Copyright 2011-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. 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 6eae754f62..815363f36c 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-2023 the original author or authors. + * Copyright 2016-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. 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 9cc47b449a..8642fc837e 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-2023 the original author or authors. + * Copyright 2011-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. 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 2f78e5dbb9..de24aff2d7 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-2023 the original author or authors. + * Copyright 2014-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. 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 05cda99c84..0af5905aec 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-2023 the original author or authors. + * Copyright 2011-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. 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 3fe906f582..ceaf0025be 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-2023 the original author or authors. + * Copyright 2011-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. 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 ebdd6b055e..8d174c89b8 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-2023 the original author or authors. + * Copyright 2011-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. 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 6f2ff597f2..ad6841054f 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-2023 the original author or authors. + * Copyright 2014-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. 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 f39a04bd9d..89c8713ea9 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-2023 the original author or authors. + * 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. 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 9304e65398..9a6e31ca16 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-2023 the original author or authors. + * Copyright 2011-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. 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 3b3f70f9b3..6f25eb7daa 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-2023 the original author or authors. + * Copyright 2011-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. 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 a3bd33c03a..1fd9e96afd 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-2023 the original author or authors. + * Copyright 2012-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. 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 2d56ac8eb1..25f3fb666f 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-2023 the original author or authors. + * Copyright 2014-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. 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 bb8ae9c5dd..24b390724d 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-2023 the original author or authors. + * Copyright 2014-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. @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.connection; -import static org.springframework.util.StringUtils.commaDelimitedListToSet; +import static org.springframework.util.StringUtils.*; import java.util.Collections; import java.util.HashMap; @@ -32,8 +32,8 @@ import org.springframework.util.StringUtils; /** - * {@link RedisConfiguration Configuration} class used to set up a {@link RedisConnection} - * with {@link RedisConnectionFactory} for connecting to Redis Sentinel(s). + * {@link RedisConfiguration Configuration} class used to set up a {@link RedisConnection} with + * {@link RedisConnectionFactory} for connecting to Redis Sentinel(s). * Useful when setting up a highly available Redis environment. * * @author Christoph Strobl @@ -41,6 +41,8 @@ * @author Mark Paluch * @author Vikas Garg * @author John Blum + * @author Samuel Klose + * @author Mustapha Zorgati * @since 1.4 */ public class RedisSentinelConfiguration implements RedisConfiguration, SentinelConfiguration { @@ -49,6 +51,9 @@ public class RedisSentinelConfiguration implements RedisConfiguration, SentinelC private static final String REDIS_SENTINEL_NODES_CONFIG_PROPERTY = "spring.redis.sentinel.nodes"; private static final String REDIS_SENTINEL_USERNAME_CONFIG_PROPERTY = "spring.redis.sentinel.username"; private static final String REDIS_SENTINEL_PASSWORD_CONFIG_PROPERTY = "spring.redis.sentinel.password"; + private static final String REDIS_SENTINEL_DATA_NODE_USERNAME_CONFIG_PROPERTY = "spring.redis.sentinel.dataNode.username"; + private static final String REDIS_SENTINEL_DATA_NODE_PASSWORD_CONFIG_PROPERTY = "spring.redis.sentinel.dataNode.password"; + private static final String REDIS_SENTINEL_DATA_NODE_DATABASE_CONFIG_PROPERTY = "spring.redis.sentinel.dataNode.database"; private int database; @@ -96,7 +101,10 @@ public RedisSentinelConfiguration(String master, Set sentinelHostAndPort * * @param propertySource must not be {@literal null}. * @since 1.5 + * @deprecated since 3.3, use {@link RedisSentinelConfiguration#of(PropertySource)} instead. This constructor will be + * made private in the next major release. */ + @Deprecated(since = "3.3") public RedisSentinelConfiguration(PropertySource propertySource) { Assert.notNull(propertySource, "PropertySource must not be null"); @@ -122,6 +130,41 @@ public RedisSentinelConfiguration(PropertySource propertySource) { String sentinelUsername = String.valueOf(propertySource.getProperty(REDIS_SENTINEL_USERNAME_CONFIG_PROPERTY)); this.setSentinelUsername(sentinelUsername); } + + if (propertySource.containsProperty(REDIS_SENTINEL_DATA_NODE_USERNAME_CONFIG_PROPERTY)) { + String dataNodeUsername = String + .valueOf(propertySource.getProperty(REDIS_SENTINEL_DATA_NODE_USERNAME_CONFIG_PROPERTY)); + this.setUsername(dataNodeUsername); + } + + if (propertySource.containsProperty(REDIS_SENTINEL_DATA_NODE_PASSWORD_CONFIG_PROPERTY)) { + String dataNodePassword = String + .valueOf(propertySource.getProperty(REDIS_SENTINEL_DATA_NODE_PASSWORD_CONFIG_PROPERTY)); + this.setPassword(dataNodePassword); + } + + if (propertySource.containsProperty(REDIS_SENTINEL_DATA_NODE_DATABASE_CONFIG_PROPERTY)) { + String databaseSource = String + .valueOf(propertySource.getProperty(REDIS_SENTINEL_DATA_NODE_DATABASE_CONFIG_PROPERTY)); + int database; + try { + database = Integer.parseInt(databaseSource); + } catch (NumberFormatException ex) { + throw new IllegalArgumentException(String.format("Invalid DB index '%s'; integer required", databaseSource)); + } + this.setDatabase(database); + } + } + + /** + * Construct a new {@link RedisSentinelConfiguration} from the given {@link PropertySource}. + * + * @param propertySource must not be {@literal null}. + * @return a new {@link RedisSentinelConfiguration} configured from the given {@link PropertySource}. + * @since 3.3 + */ + public static RedisSentinelConfiguration of(PropertySource propertySource) { + return new RedisSentinelConfiguration(propertySource); } /** @@ -286,8 +329,7 @@ public boolean equals(@Nullable Object obj) { return false; } - return this.database == that.database - && ObjectUtils.nullSafeEquals(this.master, that.master) + return this.database == that.database && ObjectUtils.nullSafeEquals(this.master, that.master) && ObjectUtils.nullSafeEquals(this.sentinels, that.sentinels) && ObjectUtils.nullSafeEquals(this.dataNodeUsername, that.dataNodeUsername) && ObjectUtils.nullSafeEquals(this.dataNodePassword, that.dataNodePassword) 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 7b87506503..0d84cc2107 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-2023 the original author or authors. + * Copyright 2014-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. 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 16a051c803..1a8b306c45 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-2023 the original author or authors. + * Copyright 2014-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. 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 6968ac45c6..26a610e05c 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-2023 the original author or authors. + * Copyright 2011-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. 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 cfb4b5727b..bd3e75deb8 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-2023 the original author or authors. + * Copyright 2011-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. 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 ad80862396..7e70cfdfd4 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-2023 the original author or authors. + * 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. 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 7b471e9594..0ec52a6b70 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-2023 the original author or authors. + * 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. 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 da8cb7eeb0..6ed05903b1 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-2023 the original author or authors. + * Copyright 2018-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. 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 e5a8141135..a326106610 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-2023 the original author or authors. + * Copyright 2018-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. 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 478e3438d0..beac673984 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-2023 the original author or authors. + * Copyright 2011-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. 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 dd58909b37..56ce5a9f35 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-2023 the original author or authors. + * Copyright 2011-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. 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 f5ba962b77..8e3578dbc2 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-2023 the original author or authors. + * Copyright 2011-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. 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 2c4f4bb140..8578d688f6 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-2023 the original author or authors. + * Copyright 2011-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. 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 4d805b0a85..5ed9e24dbf 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-2023 the original author or authors. + * Copyright 2013-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. 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 e76d466b81..e5d72b171c 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-2023 the original author or authors. + * Copyright 2021-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. 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 4d19c2545f..b90d56c6a9 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-2023 the original author or authors. + * Copyright 2011-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. 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 4017234b5a..e198eecfd3 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-2023 the original author or authors. + * Copyright 2011-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. 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 a853055374..8fbbb32239 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-2023 the original author or authors. + * Copyright 2011-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. 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 aa1fcb7b7d..5049ef2423 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-2023 the original author or authors. + * Copyright 2021-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. 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 20ef7420bc..1185756bf3 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-2023 the original author or authors. + * Copyright 2018-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. 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 dd5f07810c..98ec282faf 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-2023 the original author or authors. + * Copyright 2013-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. 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 b2fe761335..d9b87a8c86 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-2023 the original author or authors. + * Copyright 2013-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. 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 a13d34f3f4..0e708780bc 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-2023 the original author or authors. + * Copyright 2013-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. 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 57c13def9e..2d9bafca65 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-2023 the original author or authors. + * Copyright 2013-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. 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 738dae09ea..2e1e93e155 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-2023 the original author or authors. + * Copyright 2014-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. 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 523e602c6e..244306125e 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-2023 the original author or authors. + * Copyright 2013-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. 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 7a84c2b590..2d1ea32cc3 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-2023 the original author or authors. + * Copyright 2013-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. 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 59f7b4ce05..7f8889eabc 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-2023 the original author or authors. + * Copyright 2013-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. 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 5560bc851c..d2bf3aa39e 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-2023 the original author or authors. + * Copyright 2014-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. 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 1ab6d9a306..883ceb9e15 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-2023 the original author or authors. + * Copyright 2013-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. 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 b38d9c902b..50fd68211e 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-2023 the original author or authors. + * 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. 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 3dad5f7740..1c9628db0c 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-2023 the original author or authors. + * 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. 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 d3ca391a1b..af7707d9ae 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-2023 the original author or authors. + * 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. 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 16cec8f85a..5b68de45e9 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-2023 the original author or authors. + * Copyright 2015-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. 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 e3e8ebd421..1d98726325 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-2023 the original author or authors. + * 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. 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 1bfbfe550d..1803da058a 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-2023 the original author or authors. + * 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. @@ -275,13 +275,14 @@ public Cursor> hScan(byte[] key, ScanOptions options) { return new ScanCursor>(options) { @Override - protected ScanIteration> doScan(long cursorId, ScanOptions options) { + protected ScanIteration> doScan(CursorId cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); - ScanResult> result = connection.getCluster().hscan(key, JedisConverters.toBytes(cursorId), + ScanResult> result = connection.getCluster().hscan(key, + JedisConverters.toBytes(cursorId), params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult()); + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); } }.open(); } 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 becbbba430..87fdfc25d9 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-2023 the original author or authors. + * 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. 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 3525381d4e..f431d362ec 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-2023 the original author or authors. + * 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. @@ -177,11 +177,11 @@ Cursor scan(RedisClusterNode node, ScanOptions options) { return new ScanCursor(0, options) { @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); - ScanResult result = client.scan(Long.toString(cursorId), params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), + ScanResult result = client.scan(cursorId.getCursorId(), params); + return new ScanIteration<>(CursorId.of(result.getCursor()), JedisConverters.stringListToByteList().convert(result.getResult())); } }.open(); 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 f8ddfcd327..81f93645b8 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-2023 the original author or authors. + * 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. 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 9944b3e95d..727c4536d9 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-2023 the original author or authors. + * 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. 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 5e920cc85c..c0b61ae75d 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-2023 the original author or authors. + * 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. 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 01560c6173..4be0422e03 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-2023 the original author or authors. + * 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. @@ -394,11 +394,11 @@ public Cursor sScan(byte[] key, ScanOptions options) { return new ScanCursor(options) { @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); ScanResult result = connection.getCluster().sscan(key, JedisConverters.toBytes(cursorId), params); - return new ScanIteration<>(Long.parseLong(result.getCursor()), result.getResult()); + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); } }.open(); } 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 5362d2b9be..05cadae499 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-2023 the original author or authors. + * Copyright 2021-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. 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 942b71aeca..514ce81579 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-2023 the original author or authors. + * 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. 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 c090186086..156fb87fb5 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-2023 the original author or authors. + * 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. @@ -1079,13 +1079,13 @@ public Cursor zScan(byte[] key, ScanOptions options) { return new ScanCursor(options) { @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); ScanResult result = connection.getCluster().zscan(key, JedisConverters.toBytes(cursorId), params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), + return new ScanIteration<>(CursorId.of(result.getCursor()), JedisConverters.tuplesToTuples().convert(result.getResult())); } }.open(); 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 83acd8d07a..840f49dd04 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-2023 the original author or authors. + * Copyright 2011-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. 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 ba3575536a..4e83c271cf 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-2023 the original author or authors. + * Copyright 2011-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. @@ -78,8 +78,9 @@ * This connection factory implements {@link InitializingBean} and {@link SmartLifecycle} for flexible lifecycle * control. It must be {@link #afterPropertiesSet() initialized} and {@link #start() started} before you can obtain a * connection. {@link #afterPropertiesSet() Initialization} {@link SmartLifecycle#start() starts} this bean - * {@link #isAutoStartup() by default}. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() restart} - * this connection factory if needed. + * {@link #isEarlyStartup() early} by default. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() + * restart} this connection factory if needed. Disabling {@link #isEarlyStartup() early startup} leaves lifecycle + * management to the container refresh if {@link #isAutoStartup() auto-startup} is enabled. *

* Note that {@link JedisConnection} and its {@link JedisClusterConnection clustered variant} are not Thread-safe and * instances should not be shared across threads. Refer to the @@ -103,9 +104,10 @@ public class JedisConnectionFactory private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy( JedisExceptionConverter.INSTANCE); - private boolean convertPipelineAndTxResults = true; - private int phase = 0; // in between min and max values + private boolean autoStartup = true; + private boolean earlyStartup = true; + private boolean convertPipelineAndTxResults = true; private final AtomicReference state = new AtomicReference<>(State.CREATED); @@ -494,8 +496,8 @@ public int getDatabase() { * Sets the index of the database used by this connection factory. Default is 0. * * @param index database index. - * @deprecated since 2.0, configure the client name using {@link RedisSentinelConfiguration} or - * {@link RedisStandaloneConfiguration}. + * @deprecated since 2.0, configure the database index using {@link RedisStandaloneConfiguration} or + * {@link RedisSentinelConfiguration}. */ @Deprecated public void setDatabase(int index) { @@ -571,6 +573,70 @@ public RedisClusterConfiguration getClusterConfiguration() { return RedisConfiguration.isClusterConfiguration(configuration) ? (RedisClusterConfiguration) configuration : null; } + @Override + public int getPhase() { + return this.phase; + } + + /** + * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}. + * + * @since 3.2 + * @see SmartLifecycle#getPhase() + */ + public void setPhase(int phase) { + this.phase = phase; + } + + /** + * @since 3.3 + */ + @Override + public boolean isAutoStartup() { + return this.autoStartup; + } + + /** + * Configure if this Lifecycle connection factory should get started automatically by the container at the time that + * the containing ApplicationContext gets refreshed. + *

+ * This connection factory defaults to early auto-startup during {@link #afterPropertiesSet()} and can potentially + * create Redis connections early on in the lifecycle. See {@link #setEarlyStartup(boolean)} for delaying connection + * creation to the ApplicationContext refresh if auto-startup is enabled. + * + * @param autoStartup {@literal true} to automatically {@link #start()} the connection factory; {@literal false} + * otherwise. + * @since 3.3 + * @see #setEarlyStartup(boolean) + * @see #start() + */ + public void setAutoStartup(boolean autoStartup) { + this.autoStartup = autoStartup; + } + + /** + * @return whether to {@link #start()} the component during {@link #afterPropertiesSet()}. + * @since 3.3 + */ + public boolean isEarlyStartup() { + return this.earlyStartup; + } + + /** + * Configure if this InitializingBean's component Lifecycle should get started early by {@link #afterPropertiesSet()} + * at the time that the bean is initialized. The component defaults to auto-startup. + *

+ * This method is related to {@link #setAutoStartup(boolean) auto-startup} and can be used to delay Redis client + * startup until the ApplicationContext refresh. Disabling early startup does not disable auto-startup. + * + * @param earlyStartup {@literal true} to early {@link #start()} the component; {@literal false} otherwise. + * @since 3.3 + * @see #setAutoStartup(boolean) + */ + public void setEarlyStartup(boolean earlyStartup) { + this.earlyStartup = earlyStartup; + } + /** * Specifies if pipelined results should be converted to the expected data type. If {@code false}, results of * {@link JedisConnection#closePipeline()} and {@link JedisConnection#exec()} will be of the type returned by the @@ -616,7 +682,7 @@ public void afterPropertiesSet() { this.clientConfig = createClientConfig(getDatabase(), getRedisUsername(), getRedisPassword()); - if (isAutoStartup()) { + if (isEarlyStartup()) { start(); } } @@ -724,21 +790,6 @@ public void stop() { } } - @Override - public int getPhase() { - return this.phase; - } - - /** - * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}. - * - * @since 3.2 - * @see SmartLifecycle#getPhase() - */ - public void setPhase(int phase) { - this.phase = phase; - } - @Override public boolean isRunning() { return State.STARTED.equals(this.state.get()); @@ -1006,8 +1057,8 @@ private void assertInitialized() { switch (current) { case CREATED, STOPPED -> throw new IllegalStateException( String.format("JedisConnectionFactory has been %s. Use start() to initialize it", current)); - case DESTROYED -> throw new IllegalStateException( - "JedisConnectionFactory was destroyed and cannot be used anymore"); + case DESTROYED -> + throw new IllegalStateException("JedisConnectionFactory was destroyed and cannot be used anymore"); default -> throw new IllegalStateException(String.format("JedisConnectionFactory is %s", 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 a095b943db..7a4c15613c 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-2023 the original author or authors. + * Copyright 2013-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. @@ -75,6 +75,7 @@ import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter; import org.springframework.data.redis.connection.zset.DefaultTuple; import org.springframework.data.redis.connection.zset.Tuple; +import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.ScanOptions; import org.springframework.data.redis.core.types.Expiration; import org.springframework.data.redis.core.types.RedisClientInfo; @@ -175,6 +176,17 @@ public static byte[] toBytes(Number source) { return toBytes(String.valueOf(source)); } + /** + * Convert the given {@link org.springframework.data.redis.core.Cursor.CursorId} into its binary representation. + * + * @param source must not be {@literal null}. + * @return the binary representation. + * @since 3.3 + */ + static byte[] toBytes(Cursor.CursorId source) { + return toBytes(source.getCursorId()); + } + @Nullable public static byte[] toBytes(@Nullable String source) { return source == null ? null : SafeEncoder.encode(source); 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 15cd693c99..743565b76a 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-2023 the original author or authors. + * Copyright 2013-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. 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 a91cbe7bd1..a5f806974d 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-2023 the original author or authors. + * 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. 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 419d19d3f8..be2cf8bb90 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-2023 the original author or authors. + * 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. @@ -30,6 +30,7 @@ import org.springframework.data.redis.connection.RedisHashCommands; import org.springframework.data.redis.connection.convert.Converters; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -149,8 +150,7 @@ public List> hRandFieldWithValues(byte[] key, long count) List> convertedMapEntryList = new ArrayList<>(mapEntryList.size()); - mapEntryList.forEach(entry -> - convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue()))); + mapEntryList.forEach(entry -> convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue()))); return convertedMapEntryList; @@ -219,24 +219,17 @@ public List hVals(byte[] key) { @Override public Cursor> hScan(byte[] key, ScanOptions options) { - return hScan(key, 0, options); + return hScan(key, CursorId.initial(), options); } - /** - * @since 1.4 - * @param key - * @param cursorId - * @param options - * @return - */ - public Cursor> hScan(byte[] key, long cursorId, ScanOptions options) { + public Cursor> hScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor>(key, cursorId, options) { @Override - protected ScanIteration> doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration> doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new InvalidDataAccessApiUsageException("'HSCAN' cannot be called in pipeline / transaction mode"); @@ -244,9 +237,9 @@ protected ScanIteration> doScan(byte[] key, long cursorId, ScanParams params = JedisConverters.toScanParams(options); - ScanResult> result = connection.getJedis().hscan(key, JedisConverters.toBytes(cursorId), - params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult()); + ScanResult> result = connection.getJedis().hscan(key, + JedisConverters.toBytes(cursorId), params); + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); } @Override 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 16e08ad611..64e7dc92e1 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-2023 the original author or authors. + * 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. 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 ef1771969d..8d7a1cf2d3 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-2023 the original author or authors. + * Copyright 2021-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. 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 1e3f455829..58fc4e2408 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-2023 the original author or authors. + * 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. @@ -36,6 +36,7 @@ import org.springframework.data.redis.connection.ValueEncoding.RedisValueEncoding; import org.springframework.data.redis.connection.convert.Converters; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyScanOptions; import org.springframework.data.redis.core.ScanCursor; import org.springframework.data.redis.core.ScanIteration; @@ -131,7 +132,7 @@ public Set keys(byte[] pattern) { @Override public Cursor scan(ScanOptions options) { - return scan(0, options != null ? options : ScanOptions.NONE); + return scan(CursorId.initial(), options != null ? options : ScanOptions.NONE); } /** @@ -140,12 +141,12 @@ public Cursor scan(ScanOptions options) { * @param options * @return */ - public Cursor scan(long cursorId, ScanOptions options) { + public Cursor scan(CursorId cursorId, ScanOptions options) { return new ScanCursor(cursorId, options) { @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new InvalidDataAccessApiUsageException("'SCAN' cannot be called in pipeline / transaction mode"); @@ -165,12 +166,12 @@ protected ScanIteration doScan(long cursorId, ScanOptions options) { } if (type != null) { - result = connection.getJedis().scan(Long.toString(cursorId).getBytes(), params, type); + result = connection.getJedis().scan(JedisConverters.toBytes(cursorId), params, type); } else { - result = connection.getJedis().scan(Long.toString(cursorId).getBytes(), params); + result = connection.getJedis().scan(JedisConverters.toBytes(cursorId), params); } - return new ScanIteration<>(Long.parseLong(result.getCursor()), result.getResult()); + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); } protected void doClose() { 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 b2ed65e496..fc3e54259a 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-2023 the original author or authors. + * 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. 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 70c81a7a15..e44685e32b 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-2023 the original author or authors. + * Copyright 2011-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. 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 3f96bb0b91..ca68b02d43 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-2023 the original author or authors. + * 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. 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 4302b917d1..d7a2223a18 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-2023 the original author or authors. + * Copyright 2013-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. 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 4efa40faeb..13eb3178b4 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-2023 the original author or authors. + * 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. 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 291cb373f6..8af29b6792 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-2023 the original author or authors. + * Copyright 2014-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. 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 fddd3cc374..bab0522591 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-2023 the original author or authors. + * 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. 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 654b0b5c47..c9ed8280de 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-2023 the original author or authors. + * 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. @@ -27,6 +27,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.RedisSetCommands; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -206,24 +207,24 @@ public Long sUnionStore(byte[] destKey, byte[]... keys) { @Override public Cursor sScan(byte[] key, ScanOptions options) { - return sScan(key, 0, options); + return sScan(key, CursorId.initial(), options); } /** - * @since 1.4 * @param key * @param cursorId * @param options * @return + * @since 3.2.1 */ - public Cursor sScan(byte[] key, long cursorId, ScanOptions options) { + public Cursor sScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor(key, cursorId, options) { @Override - protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new InvalidDataAccessApiUsageException("'SSCAN' cannot be called in pipeline / transaction mode"); @@ -232,7 +233,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions op ScanParams params = JedisConverters.toScanParams(options); ScanResult result = connection.getJedis().sscan(key, JedisConverters.toBytes(cursorId), params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult()); + return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult()); } protected void doClose() { 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 6da69c5f1a..c3ecbe8255 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-2023 the original author or authors. + * Copyright 2021-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. 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 815f3aea87..889e87b102 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-2023 the original author or authors. + * 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. 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 b4bcc5763e..46a9b49668 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-2023 the original author or authors. + * Copyright 2011-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. 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 a19247a8d1..749e198bcb 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-2023 the original author or authors. + * 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. @@ -35,6 +35,7 @@ import org.springframework.data.redis.connection.zset.Tuple; import org.springframework.data.redis.connection.zset.Weights; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -561,24 +562,25 @@ public Long zUnionStore(byte[] destKey, byte[]... sets) { @Override public Cursor zScan(byte[] key, ScanOptions options) { - return zScan(key, 0L, options); + return zScan(key, CursorId.initial(), options); } + /** - * @since 1.4 * @param key * @param cursorId * @param options * @return + * @since 3.2.1 */ - public Cursor zScan(byte[] key, Long cursorId, ScanOptions options) { + public Cursor zScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor(key, cursorId, options) { @Override - protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new InvalidDataAccessApiUsageException("'ZSCAN' cannot be called in pipeline / transaction mode"); @@ -588,7 +590,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions opt ScanResult result = connection.getJedis().zscan(key, JedisConverters.toBytes(cursorId), params); - return new ScanIteration<>(Long.valueOf(result.getCursor()), + return new ScanIteration<>(CursorId.of(result.getCursor()), JedisConverters.tuplesToTuples().convert(result.getResult())); } 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 ccb75534ce..60d16a1f4a 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-2023 the original author or authors. + * Copyright 2021-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. 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 c30d0a9351..0b2061f5a7 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-2023 the original author or authors. + * 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. 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 08d15e2851..c166000bca 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-2023 the original author or authors. + * 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. 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 80eea51135..fac5f8ec20 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-2023 the original author or authors. + * 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. 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 57cf53ac85..d76cc2aee1 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-2023 the original author or authors. + * Copyright 2021-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. 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 8582eb5d81..6372226843 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-2023 the original author or authors. + * 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. 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 5d2f53618f..3756e9f8b4 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-2023 the original author or authors. + * Copyright 2015-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. 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 7c3ad807e7..d220ed3cb4 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-2023 the original author or authors. + * 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. 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 52159887f6..29f36d29e7 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-2023 the original author or authors. + * 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. 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 dac2765f41..d8215c338f 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-2023 the original author or authors. + * 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. 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 3be1478b8f..ae3d3b2e49 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-2023 the original author or authors. + * 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. @@ -18,11 +18,8 @@ import io.lettuce.core.KeyScanCursor; import io.lettuce.core.ScanArgs; -import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.concurrent.ThreadLocalRandom; import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.ClusterSlotHashUtil; @@ -50,47 +47,6 @@ class LettuceClusterKeyCommands extends LettuceKeyCommands { this.connection = connection; } - @Override - public byte[] randomKey() { - - List nodes = connection.clusterGetNodes(); - Set inspectedNodes = new HashSet<>(nodes.size()); - - do { - - RedisClusterNode node = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size())); - - while (inspectedNodes.contains(node)) { - node = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size())); - } - inspectedNodes.add(node); - byte[] key = randomKey(node); - - if (key != null && key.length > 0) { - return key; - } - } while (nodes.size() != inspectedNodes.size()); - - return null; - } - - @Override - public Set keys(byte[] pattern) { - - Assert.notNull(pattern, "Pattern must not be null"); - - Collection> keysPerNode = connection.getClusterCommandExecutor() - .executeCommandOnAllNodes((LettuceClusterCommandCallback>) connection -> connection.keys(pattern)) - .resultsAsList(); - - Set keys = new HashSet<>(); - - for (List keySet : keysPerNode) { - keys.addAll(keySet); - } - return keys; - } - @Override public void rename(byte[] oldKey, byte[] newKey) { 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 1b4d43c1ba..f7905764e5 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-2023 the original author or authors. + * 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. 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 b014afc8dd..6d2e66cda0 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-2023 the original author or authors. + * 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. @@ -18,7 +18,6 @@ import io.lettuce.core.api.sync.RedisServerCommands; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -34,7 +33,6 @@ import org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.LettuceClusterCommandCallback; import org.springframework.data.redis.core.types.RedisClientInfo; import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; /** * @author Mark Paluch @@ -71,37 +69,11 @@ public void save(RedisClusterNode node) { executeCommandOnSingleNode(RedisServerCommands::save, node); } - @Override - public Long dbSize() { - - Collection dbSizes = executeCommandOnAllNodes(RedisServerCommands::dbsize).resultsAsList(); - - if (CollectionUtils.isEmpty(dbSizes)) { - return 0L; - } - - Long size = 0L; - for (Long value : dbSizes) { - size += value; - } - return size; - } - @Override public Long dbSize(RedisClusterNode node) { return executeCommandOnSingleNode(RedisServerCommands::dbsize, node).getValue(); } - @Override - public void flushDb() { - executeCommandOnAllNodes(RedisServerCommands::flushdb); - } - - @Override - public void flushDb(FlushOption option) { - executeCommandOnAllNodes(it -> it.flushdb(LettuceConverters.toFlushMode(option))); - } - @Override public void flushDb(RedisClusterNode node) { executeCommandOnSingleNode(RedisServerCommands::flushdb, node); @@ -112,16 +84,6 @@ public void flushDb(RedisClusterNode node, FlushOption option) { executeCommandOnSingleNode(it -> it.flushdb(LettuceConverters.toFlushMode(option)), node); } - @Override - public void flushAll() { - executeCommandOnAllNodes(RedisServerCommands::flushall); - } - - @Override - public void flushAll(FlushOption option) { - executeCommandOnAllNodes(it -> it.flushall(LettuceConverters.toFlushMode(option))); - } - @Override public void flushAll(RedisClusterNode node) { executeCommandOnSingleNode(RedisServerCommands::flushall, node); @@ -220,7 +182,7 @@ public Properties getConfig(RedisClusterNode node, String pattern) { public void setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); executeCommandOnAllNodes(client -> client.configSet(param, value)); } 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 d8f7a99f37..3a346141c2 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-2023 the original author or authors. + * 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. 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 315bef842d..4b6ae60f04 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-2023 the original author or authors. + * 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. @@ -15,11 +15,6 @@ */ package org.springframework.data.redis.connection.lettuce; -import java.util.Map; - -import org.springframework.data.redis.connection.ClusterSlotHashUtil; -import org.springframework.util.Assert; - /** * @author Christoph Strobl * @author Mark Paluch @@ -31,21 +26,4 @@ class LettuceClusterStringCommands extends LettuceStringCommands { super(connection); } - @Override - public Boolean mSetNX(Map tuples) { - - Assert.notNull(tuples, "Tuples must not be null"); - - if (ClusterSlotHashUtil.isSameSlotForAllKeys(tuples.keySet().toArray(new byte[tuples.keySet().size()][]))) { - return super.mSetNX(tuples); - } - - boolean result = true; - for (Map.Entry entry : tuples.entrySet()) { - if (!setNX(entry.getKey(), entry.getValue()) && result) { - result = false; - } - } - return result; - } } 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 3f5d520150..5176bf68e1 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-2023 the original author or authors. + * 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. 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 0148fe3da6..fa80eeda87 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-2023 the original author or authors. + * 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. 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 01ba6a780c..c3ecbde730 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-2023 the original author or authors. + * Copyright 2011-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. @@ -49,7 +49,9 @@ import java.util.List; import java.util.Map; import java.util.Queue; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; @@ -57,6 +59,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeanUtils; import org.springframework.core.convert.converter.Converter; import org.springframework.dao.DataAccessException; @@ -70,6 +73,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider.TargetAware; import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceResultBuilder; import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceStatusResult; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.RedisCommand; import org.springframework.lang.Nullable; import org.springframework.util.Assert; @@ -100,8 +104,8 @@ */ public class LettuceConnection extends AbstractRedisConnection { - private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = - new FallbackExceptionTranslationStrategy(LettuceExceptionConverter.INSTANCE); + private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new FallbackExceptionTranslationStrategy( + LettuceExceptionConverter.INSTANCE); static final RedisCodec CODEC = ByteArrayCodec.INSTANCE; @@ -187,8 +191,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share /** * Creates a new {@link LettuceConnection}. * - * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. - * Should not be used for transactions or blocking operations. + * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be + * used for transactions or blocking operations. * @param timeout The connection timeout (in milliseconds) * @param client The {@link RedisClient} to use when making pub/sub connections. * @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection. @@ -207,8 +211,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share /** * Creates a new {@link LettuceConnection}. * - * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. - * Should not be used for transactions or blocking operations. + * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be + * used for transactions or blocking operations. * @param connectionProvider connection provider to obtain and release native connections. * @param timeout The connection timeout (in milliseconds) * @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection. @@ -223,8 +227,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share /** * Creates a new {@link LettuceConnection}. * - * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. - * Should not be used for transactions or blocking operations. + * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be + * used for transactions or blocking operations. * @param connectionProvider connection provider to obtain and release native connections. * @param timeout The connection timeout (in milliseconds) * @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection. @@ -451,24 +455,19 @@ private LettuceInvoker doInvoke(RedisClusterAsyncCommands connec LettuceResult newLettuceResult(Future resultHolder, Converter converter) { - return LettuceResultBuilder.forResponse(resultHolder) - .mappedWith(converter) - .convertPipelineAndTxResults(this.convertPipelineAndTxResults) - .build(); + return LettuceResultBuilder. forResponse(resultHolder).mappedWith(converter) + .convertPipelineAndTxResults(this.convertPipelineAndTxResults).build(); } LettuceResult newLettuceResult(Future resultHolder, Converter converter, Supplier defaultValue) { - return LettuceResultBuilder.forResponse(resultHolder) - .mappedWith(converter) - .convertPipelineAndTxResults(this.convertPipelineAndTxResults) - .defaultNullTo(defaultValue) - .build(); + return LettuceResultBuilder. forResponse(resultHolder).mappedWith(converter) + .convertPipelineAndTxResults(this.convertPipelineAndTxResults).defaultNullTo(defaultValue).build(); } LettuceResult newLettuceStatusResult(Future resultHolder) { - return LettuceResultBuilder.forResponse(resultHolder).buildStatusResult(); + return LettuceResultBuilder. forResponse(resultHolder).buildStatusResult(); } void pipeline(LettuceResult result) { @@ -581,7 +580,7 @@ public List closePipeline() { pipeliningFlushState = null; isPipelined = false; - List> futures = new ArrayList<>(ppline.size()); + List> futures = new ArrayList<>(ppline.size()); for (LettuceResult result : ppline) { futures.add(result.getResultHolder()); @@ -598,10 +597,24 @@ public List closePipeline() { if (done) { for (LettuceResult result : ppline) { - if (result.getResultHolder().getOutput().hasError()) { + CompletableFuture resultHolder = result.getResultHolder(); + if (resultHolder.isCompletedExceptionally()) { + + String message; + if (resultHolder instanceof io.lettuce.core.protocol.RedisCommand rc) { + message = rc.getOutput().getError(); + } else { + try { + resultHolder.get(); + message = ""; + } catch (InterruptedException ignore) { + message = ""; + } catch (ExecutionException e) { + message = e.getCause().getMessage(); + } + } - Exception exception = new InvalidDataAccessApiUsageException(result.getResultHolder() - .getOutput().getError()); + Exception exception = new InvalidDataAccessApiUsageException(message); // remember only the first error if (problem == null) { @@ -682,8 +695,8 @@ public List exec() { LettuceTransactionResultConverter resultConverter = new LettuceTransactionResultConverter( new LinkedList<>(txResults), exceptionConverter); - pipeline(newLettuceResult(exec, source -> - resultConverter.convert(LettuceConverters.transactionResultUnwrapper().convert(source)))); + pipeline(newLettuceResult(exec, + source -> resultConverter.convert(LettuceConverters.transactionResultUnwrapper().convert(source)))); return null; } @@ -835,8 +848,7 @@ T failsafeReadScanValues(List source, @SuppressWarnings("rawtypes") @Null try { return (T) (converter != null ? converter.convert(source) : source); - } catch (IndexOutOfBoundsException ignore) { - } + } catch (IndexOutOfBoundsException ignore) {} return null; } @@ -1060,8 +1072,8 @@ private void potentiallySelectDatabase(int dbIndex) { } } - io.lettuce.core.ScanCursor getScanCursor(long cursorId) { - return io.lettuce.core.ScanCursor.of(Long.toString(cursorId)); + io.lettuce.core.ScanCursor getScanCursor(CursorId cursorId) { + return io.lettuce.core.ScanCursor.of(cursorId.getCursorId()); } private void validateCommandIfRunningInTransactionMode(ProtocolKeyword cmd, byte[]... args) { 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 f3c818a510..c406faaa1e 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-2023 the original author or authors. + * Copyright 2011-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. @@ -15,8 +15,7 @@ */ package org.springframework.data.redis.connection.lettuce; -import static org.springframework.data.redis.connection.lettuce.LettuceConnection.CODEC; -import static org.springframework.data.redis.connection.lettuce.LettuceConnection.PipeliningFlushPolicy; +import static org.springframework.data.redis.connection.lettuce.LettuceConnection.*; import io.lettuce.core.AbstractRedisClient; import io.lettuce.core.ClientOptions; @@ -50,6 +49,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.SmartLifecycle; @@ -59,23 +59,10 @@ import org.springframework.data.redis.ExceptionTranslationStrategy; import org.springframework.data.redis.PassThroughExceptionTranslationStrategy; import org.springframework.data.redis.RedisConnectionFailureException; -import org.springframework.data.redis.connection.ClusterCommandExecutor; -import org.springframework.data.redis.connection.ClusterTopologyProvider; -import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; -import org.springframework.data.redis.connection.RedisClusterConfiguration; -import org.springframework.data.redis.connection.RedisClusterConnection; -import org.springframework.data.redis.connection.RedisConfiguration; +import org.springframework.data.redis.connection.*; 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.connection.RedisConnection; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.connection.RedisPassword; -import org.springframework.data.redis.connection.RedisSentinelConfiguration; -import org.springframework.data.redis.connection.RedisSentinelConnection; -import org.springframework.data.redis.connection.RedisSocketConfiguration; -import org.springframework.data.redis.connection.RedisStandaloneConfiguration; -import org.springframework.data.redis.connection.RedisStaticMasterReplicaConfiguration; import org.springframework.data.redis.util.RedisAssertions; import org.springframework.data.util.Optionals; import org.springframework.lang.Nullable; @@ -85,7 +72,8 @@ import org.springframework.util.StringUtils; /** - * {@link RedisConnectionFactory Connection factory} creating Lettuce-based connections. + * {@link RedisConnectionFactory Connection factory} creating Lettuce-based + * connections. *

* This factory creates a new {@link LettuceConnection} on each call to {@link #getConnection()}. While multiple * {@link LettuceConnection}s share a single thread-safe native connection by default, {@link LettuceConnection} and its @@ -112,8 +100,9 @@ * This connection factory implements {@link InitializingBean} and {@link SmartLifecycle} for flexible lifecycle * control. It must be {@link #afterPropertiesSet() initialized} and {@link #start() started} before you can obtain a * connection. {@link #afterPropertiesSet() Initialization} {@link SmartLifecycle#start() starts} this bean - * {@link #isAutoStartup() by default}. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() restart} - * this connection factory if needed. + * {@link #isEarlyStartup() early} by default. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() + * restart} this connection factory if needed. Disabling {@link #isEarlyStartup() early startup} leaves lifecycle + * management to the container refresh if {@link #isAutoStartup() auto-startup} is enabled. * * @author Costin Leau * @author Jennifer Hickey @@ -133,13 +122,14 @@ public class LettuceConnectionFactory implements RedisConnectionFactory, Reactiv private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy( LettuceExceptionConverter.INSTANCE); + private int phase = 0; // in between min and max values + private boolean autoStartup = true; + private boolean earlyStartup = true; private boolean convertPipelineAndTxResults = true; private boolean eagerInitialization = false; + private boolean shareNativeConnection = true; private boolean validateConnection = false; - - private int phase = 0; // in between min and max values - private @Nullable AbstractRedisClient client; private final AtomicReference state = new AtomicReference<>(State.CREATED); @@ -568,12 +558,13 @@ public void setShareNativeConnection(boolean shareNativeConnection) { /** * Indicates {@link #setShareNativeConnection(boolean) shared connections} should be eagerly initialized. Eager - * initialization requires a running Redis instance during application startup to allow early validation of connection - * factory configuration. Eager initialization also prevents blocking connect while using reactive API and is - * recommended for reactive API usage. + * initialization requires a running Redis instance during {@link #start() startup} to allow early validation of + * connection factory configuration. Eager initialization also prevents blocking connect while using reactive API and + * is recommended for reactive API usage. * - * @return {@link true} if the shared connection is initialized upon {@link #afterPropertiesSet()}. + * @return {@link true} if the shared connection is initialized upon {@link #start()}. * @since 2.2 + * @see #start() */ public boolean getEagerInitialization() { return this.eagerInitialization; @@ -602,8 +593,12 @@ public int getDatabase() { /** * Sets the index of the database used by this connection factory. Default is 0. * - * @param index database index + * @param index database index. + * @deprecated since 3.2, configure the database index using {@link RedisStandaloneConfiguration}, + * {@link RedisSocketConfiguration}, {@link RedisSentinelConfiguration}, or + * {@link RedisStaticMasterReplicaConfiguration}. */ + @Deprecated public void setDatabase(int index) { Assert.isTrue(index >= 0, "invalid DB index (a positive index required)"); @@ -672,7 +667,7 @@ public AbstractRedisClient getNativeClient() { public AbstractRedisClient getRequiredNativeClient() { return RedisAssertions.requireState(getNativeClient(), - "Client not yet initialized; Did you forget to call initialize the bean"); + "Client not yet initialized; Did you forget to call initialize the bean"); } @Nullable @@ -803,6 +798,70 @@ public RedisClusterConfiguration getClusterConfiguration() { return isClusterAware() ? (RedisClusterConfiguration) this.configuration : null; } + @Override + public int getPhase() { + return this.phase; + } + + /** + * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}. + * + * @since 3.2 + * @see SmartLifecycle#getPhase() + */ + public void setPhase(int phase) { + this.phase = phase; + } + + /** + * @since 3.3 + */ + @Override + public boolean isAutoStartup() { + return this.autoStartup; + } + + /** + * Configure if this Lifecycle connection factory should get started automatically by the container at the time that + * the containing ApplicationContext gets refreshed. + *

+ * This connection factory defaults to early auto-startup during {@link #afterPropertiesSet()} and can potentially + * create Redis connections early on in the lifecycle. See {@link #setEarlyStartup(boolean)} for delaying connection + * creation to the ApplicationContext refresh if auto-startup is enabled. + * + * @param autoStartup {@literal true} to automatically {@link #start()} the connection factory; {@literal false} + * otherwise. + * @since 3.3 + * @see #setEarlyStartup(boolean) + * @see #start() + */ + public void setAutoStartup(boolean autoStartup) { + this.autoStartup = autoStartup; + } + + /** + * @return whether to {@link #start()} the component during {@link #afterPropertiesSet()}. + * @since 3.3 + */ + public boolean isEarlyStartup() { + return this.earlyStartup; + } + + /** + * Configure if this InitializingBean's component Lifecycle should get started early by {@link #afterPropertiesSet()} + * at the time that the bean is initialized. The component defaults to auto-startup. + *

+ * This method is related to {@link #setAutoStartup(boolean) auto-startup} and can be used to delay Redis client + * startup until the ApplicationContext refresh. Disabling early startup does not disable auto-startup. + * + * @param earlyStartup {@literal true} to early {@link #start()} the component; {@literal false} otherwise. + * @since 3.3 + * @see #setAutoStartup(boolean) + */ + public void setEarlyStartup(boolean earlyStartup) { + this.earlyStartup = earlyStartup; + } + /** * Specifies if pipelined results should be converted to the expected data type. If {@code false}, results of * {@link LettuceConnection#closePipeline()} and {LettuceConnection#exec()} will be of the type returned by the @@ -932,21 +991,6 @@ public void stop() { state.set(State.STOPPED); } - @Override - public int getPhase() { - return this.phase; - } - - /** - * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}. - * - * @since 3.2 - * @see SmartLifecycle#getPhase() - */ - public void setPhase(int phase) { - this.phase = phase; - } - @Override public boolean isRunning() { return State.STARTED.equals(this.state.get()); @@ -955,7 +999,7 @@ public boolean isRunning() { @Override public void afterPropertiesSet() { - if (isAutoStartup()) { + if (isEarlyStartup()) { start(); } } @@ -1002,8 +1046,8 @@ public RedisConnection getConnection() { return getClusterConnection(); } - LettuceConnection connection = - doCreateLettuceConnection(getSharedConnection(), this.connectionProvider, getTimeout(), getDatabase()); + LettuceConnection connection = doCreateLettuceConnection(getSharedConnection(), this.connectionProvider, + getTimeout(), getDatabase()); connection.setConvertPipelineAndTxResults(this.convertPipelineAndTxResults); @@ -1141,7 +1185,7 @@ public void resetConnection() { doInLock(() -> { Optionals.toStream(Optional.ofNullable(this.connection), Optional.ofNullable(this.reactiveConnection)) - .forEach(SharedConnection::resetConnection); + .forEach(SharedConnection::resetConnection); this.connection = null; this.reactiveConnection = null; @@ -1251,7 +1295,7 @@ protected LettuceConnectionProvider doCreateConnectionProvider(AbstractRedisClie return isStaticMasterReplicaAware() ? createStaticMasterReplicaConnectionProvider((RedisClient) client, codec) : isClusterAware() ? createClusterConnectionProvider((RedisClusterClient) client, codec) - : createStandaloneConnectionProvider((RedisClient) client, codec); + : createStandaloneConnectionProvider((RedisClient) client, codec); } @SuppressWarnings("all") @@ -1278,8 +1322,7 @@ protected AbstractRedisClient createClient() { return isStaticMasterReplicaAware() ? createStaticMasterReplicaClient() : isRedisSentinelAware() ? createSentinelClient() - : isClusterAware() ? createClusterClient() - : createBasicClient(); + : isClusterAware() ? createClusterClient() : createBasicClient(); } private RedisClient createStaticMasterReplicaClient() { @@ -1345,8 +1388,7 @@ private RedisClusterClient createClusterClient() { ClusterConfiguration clusterConfiguration = (ClusterConfiguration) this.configuration; clusterConfiguration.getClusterNodes().stream() - .map(node -> createRedisURIAndApplySettings(node.getHost(), node.getPort())) - .forEach(initialUris::add); + .map(node -> createRedisURIAndApplySettings(node.getHost(), node.getPort())).forEach(initialUris::add); RedisClusterClient clusterClient = this.clientConfiguration.getClientResources() .map(clientResources -> RedisClusterClient.create(clientResources, initialUris)) @@ -1399,8 +1441,8 @@ private void assertStarted() { switch (current) { case CREATED, STOPPED -> throw new IllegalStateException( String.format("LettuceConnectionFactory has been %s. Use start() to initialize it", current)); - case DESTROYED -> throw new IllegalStateException( - "LettuceConnectionFactory was destroyed and cannot be used anymore"); + case DESTROYED -> + throw new IllegalStateException("LettuceConnectionFactory was destroyed and cannot be used anymore"); default -> throw new IllegalStateException(String.format("LettuceConnectionFactory is %s", current)); } } @@ -1431,9 +1473,7 @@ private RedisURI createRedisURIAndApplySettings(String host, int port) { private RedisURI createRedisSocketURIAndApplySettings(String socketPath) { return applyAuthentication(RedisURI.Builder.socket(socketPath)) - .withTimeout(this.clientConfiguration.getCommandTimeout()) - .withDatabase(getDatabase()) - .build(); + .withTimeout(this.clientConfiguration.getCommandTimeout()).withDatabase(getDatabase()).build(); } private RedisURI.Builder applyAuthentication(RedisURI.Builder builder) { @@ -1467,7 +1507,10 @@ private long getClientTimeout() { } private void doInLock(Runnable runnable) { - doInLock(() -> { runnable.run(); return null; }); + doInLock(() -> { + runnable.run(); + return null; + }); } private T doInLock(Supplier supplier) { @@ -1476,8 +1519,7 @@ private T doInLock(Supplier supplier) { try { return supplier.get(); - } - finally { + } finally { this.lock.unlock(); } } @@ -1539,12 +1581,12 @@ private StatefulConnection getNativeConnection() { } /** - * Null-safe operation to evaluate whether the given {@link StatefulConnection connetion} - * is {@link StatefulConnection#isOpen() open}. + * Null-safe operation to evaluate whether the given {@link StatefulConnection connetion} is + * {@link StatefulConnection#isOpen() open}. * * @param connection {@link StatefulConnection} to evaluate. - * @return a boolean value indicating whether the given {@link StatefulConnection} is not {@literal null} - * and is {@link StatefulConnection#isOpen() open}. + * @return a boolean value indicating whether the given {@link StatefulConnection} is not {@literal null} and is + * {@link StatefulConnection#isOpen() open}. * @see io.lettuce.core.api.StatefulConnection#isOpen() */ private boolean isOpen(@Nullable StatefulConnection connection) { @@ -1554,8 +1596,8 @@ private boolean isOpen(@Nullable StatefulConnection connection) { /** * Validate the {@link StatefulConnection connection}. *

- * {@link StatefulConnection Connections} are considered valid if they can send/receive ping packets. - * Invalid {@link StatefulConnection connections} will be closed and the connection state will be reset. + * {@link StatefulConnection Connections} are considered valid if they can send/receive ping packets. Invalid + * {@link StatefulConnection connections} will be closed and the connection state will be reset. */ void validateConnection() { 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 6334d4db33..cdfcf5c980 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-2023 the original author or authors. + * 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. 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 8990995599..d4aa2d9cc8 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-2023 the original author or authors. + * Copyright 2013-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. 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 f6bfa7a1cd..1b0a27441c 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-2023 the original author or authors. + * Copyright 2013-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. 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 6adaa5f4ab..f1f56e1b5c 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-2023 the original author or authors. + * Copyright 2018-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. 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 cc94010393..f0ff6e2715 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-2023 the original author or authors. + * 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. 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 cf1c652700..5125a82fb6 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-2023 the original author or authors. + * 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. @@ -29,6 +29,7 @@ import org.springframework.data.redis.connection.RedisHashCommands; import org.springframework.data.redis.connection.convert.Converters; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -204,24 +205,25 @@ public List hVals(byte[] key) { @Override public Cursor> hScan(byte[] key, ScanOptions options) { - return hScan(key, 0, options); + return hScan(key, CursorId.initial(), options); } + /** - * @since 1.4 * @param key * @param cursorId * @param options * @return + * @since 1.4 */ - public Cursor> hScan(byte[] key, long cursorId, ScanOptions options) { + public Cursor> hScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor>(key, cursorId, options) { @Override - protected ScanIteration> doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration> doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (connection.isQueueing() || connection.isPipelined()) { throw new InvalidDataAccessApiUsageException("'HSCAN' cannot be called in pipeline / transaction mode"); @@ -235,7 +237,7 @@ protected ScanIteration> doScan(byte[] key, long cursorId, String nextCursorId = mapScanCursor.getCursor(); Map values = mapScanCursor.getMap(); - return new ScanIteration<>(Long.valueOf(nextCursorId), values.entrySet()); + return new ScanIteration<>(CursorId.of(nextCursorId), values.entrySet()); } @Override 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 a260137cf6..12fbbd5be2 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-2023 the original author or authors. + * 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. 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 6c4b640afb..7661db4a73 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-2023 the original author or authors. + * Copyright 2021-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. 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 c4d5e88fbf..415da2ccaa 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-2023 the original author or authors. + * 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. 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 8e0bcb1f20..cc1be60431 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-2023 the original author or authors. + * 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. 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 458b64da3b..2c4b021bbd 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-2023 the original author or authors. + * Copyright 2011-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. 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 246a02d41c..c9fa6c242e 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-2023 the original author or authors. + * 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. 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 c6e321b31d..d82e88c3a0 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-2023 the original author or authors. + * 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. 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 d4be69a17c..c797927296 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-2023 the original author or authors. + * Copyright 2016-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. 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 959fa54c3d..9b5969d88d 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-2023 the original author or authors. + * Copyright 2016-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. 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 634ace5004..999207aa75 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-2023 the original author or authors. + * Copyright 2016-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. 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 5b741fdd42..87c34658f8 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-2023 the original author or authors. + * Copyright 2016-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. 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 160701811f..2001abdf17 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-2023 the original author or authors. + * Copyright 2016-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. 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 fddd98bf7d..d25f6c1c95 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-2023 the original author or authors. + * Copyright 2016-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. 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 068c04551c..e4907f90ce 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-2023 the original author or authors. + * 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. 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 88559991de..fca3ee62de 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-2023 the original author or authors. + * 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. 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 3fdea2cf7e..be5790956f 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-2023 the original author or authors. + * Copyright 2016-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. 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 cd5435b388..9de831682a 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-2023 the original author or authors. + * Copyright 2018-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. 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 befc3360b8..b0d4e6a1b8 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-2023 the original author or authors. + * Copyright 2016-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. 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 bd559c751a..ccd8de9354 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-2023 the original author or authors. + * Copyright 2016-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. 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 0d04d66168..4502f5eb07 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-2023 the original author or authors. + * Copyright 2016-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. 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 9227fa0b86..0837489840 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-2023 the original author or authors. + * Copyright 2016-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. 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 1994cfccab..f4cd6e9186 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-2023 the original author or authors. + * Copyright 2016-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. 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 97fc100cea..a7df677064 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-2023 the original author or authors. + * Copyright 2016-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. 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 68682a78f6..2721877f4c 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-2023 the original author or authors. + * Copyright 2016-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. 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 035ba478e4..fd4b0de4f6 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-2023 the original author or authors. + * Copyright 2016-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. 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 e81bcea995..7e25074679 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-2023 the original author or authors. + * Copyright 2018-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. 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 4a3bb81d07..a688e94060 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-2023 the original author or authors. + * Copyright 2016-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. 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 281144d2d1..b99c098096 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-2023 the original author or authors. + * Copyright 2016-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. 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 497cdf21cc..c6d5686486 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-2023 the original author or authors. + * 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. 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 15c203b894..f3aa9bd2af 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-2023 the original author or authors. + * 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. @@ -130,7 +130,7 @@ public Mono getConfig(String pattern) { public Mono setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); return connection.execute(c -> c.configSet(param, value)).next(); } 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 3003e1d4e1..8fd0d4f403 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-2023 the original author or authors. + * Copyright 2016-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. 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 6914259b18..e22b298146 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-2023 the original author or authors. + * Copyright 2018-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. 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 77021a0d03..5008c5e68d 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-2023 the original author or authors. + * Copyright 2016-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. 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 c259e89929..9098c14c84 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-2023 the original author or authors. + * Copyright 2018-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. 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 73b3f27ed6..d11f6229be 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-2023 the original author or authors. + * Copyright 2016-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. 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 665431c3a1..4c0a825c85 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-2023 the original author or authors. + * 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. @@ -15,8 +15,7 @@ */ package org.springframework.data.redis.connection.lettuce; -import io.lettuce.core.protocol.RedisCommand; - +import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.function.Supplier; @@ -34,7 +33,7 @@ * @since 2.1 */ @SuppressWarnings("rawtypes") -class LettuceResult extends FutureResult> { +class LettuceResult extends FutureResult> { private final boolean convertPipelineAndTxResults; @@ -51,7 +50,7 @@ class LettuceResult extends FutureResult> { LettuceResult(Future resultHolder, Supplier defaultReturnValue, boolean convertPipelineAndTxResults, @Nullable Converter converter) { - super((RedisCommand) resultHolder, converter, defaultReturnValue); + super((CompletableFuture) resultHolder, converter, defaultReturnValue); this.convertPipelineAndTxResults = convertPipelineAndTxResults; } @@ -59,7 +58,7 @@ class LettuceResult extends FutureResult> { @Override @SuppressWarnings("unchecked") public T get() { - return (T) getResultHolder().getOutput().get(); + return (T) getResultHolder().join(); } @Override 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 e5276b2fb7..6f5ed1a945 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-2023 the original author or authors. + * 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. @@ -46,9 +46,9 @@ abstract class LettuceScanCursor extends ScanCursor { } @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { - if (state == null && cursorId == 0) { + if (state == null && cursorId.isInitial()) { return scanAndProcessState(io.lettuce.core.ScanCursor.INITIAL, options); } @@ -64,7 +64,7 @@ protected ScanIteration doScan(long cursorId, ScanOptions options) { } @Override - protected boolean isFinished(long cursorId) { + protected boolean isFinished(CursorId cursorId) { return state != null && isMatchingCursor(cursorId) ? state.isFinished() : super.isFinished(cursorId); } @@ -76,8 +76,8 @@ private ScanIteration scanAndProcessState(io.lettuce.core.ScanCursor scanCurs return iteration; } - private boolean isMatchingCursor(long cursorId) { - return state != null && state.getCursor().equals(Long.toString(cursorId)); + private boolean isMatchingCursor(CursorId cursorId) { + return state != null && state.getCursor().equals(cursorId.getCursorId()); } /** @@ -101,7 +101,7 @@ static class LettuceScanIteration extends ScanIteration { LettuceScanIteration(io.lettuce.core.ScanCursor cursor, Collection items) { - super(Long.parseLong(cursor.getCursor()), items); + super(CursorId.of(cursor.getCursor()), items); this.cursor = cursor; } } 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 e41368d501..de38a44747 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-2023 the original author or authors. + * 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. 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 d512e6ed77..79bf304a91 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-2023 the original author or authors. + * Copyright 2014-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. 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 1acb7dff1c..54a1dcfd6d 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-2023 the original author or authors. + * 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. @@ -145,7 +145,7 @@ public Properties getConfig(String pattern) { public void setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); connection.invokeStatus().just(RedisServerAsyncCommands::configSet, param, value); } 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 4629be67c8..3e210bdedd 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-2023 the original author or authors. + * 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. @@ -27,6 +27,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.RedisSetCommands; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -201,24 +202,24 @@ public Long sUnionStore(byte[] destKey, byte[]... keys) { @Override public Cursor sScan(byte[] key, ScanOptions options) { - return sScan(key, 0, options); + return sScan(key, CursorId.initial(), options); } /** - * @since 1.4 * @param key * @param cursorId * @param options * @return + * @since 1.4 */ - public Cursor sScan(byte[] key, long cursorId, ScanOptions options) { + public Cursor sScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor(key, cursorId, options) { @Override - protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (connection.isQueueing() || connection.isPipelined()) { throw new InvalidDataAccessApiUsageException("'SSCAN' cannot be called in pipeline / transaction mode"); @@ -232,7 +233,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions op String nextCursorId = valueScanCursor.getCursor(); List values = connection.failsafeReadScanValues(valueScanCursor.getValues(), null); - return new ScanIteration<>(Long.valueOf(nextCursorId), values); + return new ScanIteration<>(CursorId.of(nextCursorId), values); } protected void doClose() { 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 4ef6fc80fc..7f15f68e8e 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-2023 the original author or authors. + * Copyright 2018-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. 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 f6c552f042..1397fc9ce7 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-2023 the original author or authors. + * 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. 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 e007c6d63b..72acfef38f 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-2023 the original author or authors. + * Copyright 2011-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. 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 cc3e63601d..9ebccac7b9 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-2023 the original author or authors. + * 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. @@ -35,6 +35,7 @@ import org.springframework.data.redis.connection.zset.Tuple; import org.springframework.data.redis.connection.zset.Weights; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.Cursor.CursorId; import org.springframework.data.redis.core.KeyBoundCursor; import org.springframework.data.redis.core.ScanIteration; import org.springframework.data.redis.core.ScanOptions; @@ -530,20 +531,20 @@ public Long zUnionStore(byte[] destKey, byte[]... sets) { @Override public Cursor zScan(byte[] key, ScanOptions options) { - return zScan(key, 0L, options); + return zScan(key, CursorId.initial(), options); } /** * @since 1.4 */ - public Cursor zScan(byte[] key, long cursorId, ScanOptions options) { + public Cursor zScan(byte[] key, CursorId cursorId, ScanOptions options) { Assert.notNull(key, "Key must not be null"); return new KeyBoundCursor(key, cursorId, options) { @Override - protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) { if (connection.isQueueing() || connection.isPipelined()) { throw new InvalidDataAccessApiUsageException("'ZSCAN' cannot be called in pipeline / transaction mode"); @@ -559,7 +560,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions opt List> result = scoredValueScanCursor.getValues(); List values = connection.failsafeReadScanValues(result, LettuceConverters.scoredValuesToTupleList()); - return new ScanIteration<>(Long.valueOf(nextCursorId), values); + return new ScanIteration<>(CursorId.of(nextCursorId), values); } @Override 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 d306860054..7777c165d9 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-2023 the original author or authors. + * Copyright 2018-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. 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 4471e9d415..637999d1d9 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-2023 the original author or authors. + * Copyright 2018-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. 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 f1e2924103..e34b8f5757 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-2023 the original author or authors. + * Copyright 2022-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. 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 841e378d6f..15bcd3d1bb 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-2023 the original author or authors. + * 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. 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 51f3d7958b..ca3d4337b0 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-2023 the original author or authors. + * Copyright 2018-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. 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 8d1fe8b153..a243a44748 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-2023 the original author or authors. + * Copyright 2018-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. 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 0486c7315e..fc9d3ab70a 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-2023 the original author or authors. + * Copyright 2022-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. 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 4e44472362..fa662181f5 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-2023 the original author or authors. + * Copyright 2022-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. 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 00230bb469..e1a77d3e7b 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-2023 the original author or authors. + * Copyright 2022-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. 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 d54f73b9b8..92c1e0ee0a 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-2023 the original author or authors. + * Copyright 2022-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. 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 72aa9fdc96..010c5eb155 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-2023 the original author or authors. + * Copyright 2022-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. 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 05e87ff12f..fb57b0fd82 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-2023 the original author or authors. + * Copyright 2013-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. 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 419fe4bff6..ecc6b26fe1 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-2023 the original author or authors. + * Copyright 2022-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. 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 abceca8d66..990dc0ffc6 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-2023 the original author or authors. + * Copyright 2018-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. 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 df928f2c78..f2d97ca812 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-2023 the original author or authors. + * Copyright 2018-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. 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 00add551b2..6219266652 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-2023 the original author or authors. + * Copyright 2018-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. 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 d0b6299ceb..731af14240 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-2023 the original author or authors. + * Copyright 2018-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. 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 d00a87820a..62c42775a6 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-2023 the original author or authors. + * Copyright 2018-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. 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 80a281b1f2..7358645534 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-2023 the original author or authors. + * Copyright 2020-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. 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 02ca7edb61..80a3e146db 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-2023 the original author or authors. + * Copyright 2020-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. 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 e6dd8f9395..5716b2f34f 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-2023 the original author or authors. + * Copyright 2020-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. 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 4ea87d361a..7efec2110c 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-2023 the original author or authors. + * Copyright 2018-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. 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 d17c3f142d..4c34d5ce87 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-2023 the original author or authors. + * Copyright 2018-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. 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 62be1fbadc..5791a116d4 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-2023 the original author or authors. + * Copyright 2018-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. 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 a48d767da6..c822fcea47 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-2023 the original author or authors. + * Copyright 2020-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. 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 f4c1b4e8a1..5ceb927972 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-2023 the original author or authors. + * Copyright 2018-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. 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 4ea53c461b..45c456c0bc 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-2023 the original author or authors. + * Copyright 2018-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. 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 47536fc5ac..bf9a34eec3 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-2023 the original author or authors. + * Copyright 2018-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. 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 ba6818ce76..6558727a0b 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-2023 the original author or authors. + * Copyright 2018-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. 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 2fd460a205..b1b8bce931 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-2023 the original author or authors. + * Copyright 2018-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. 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 442b4c6254..d04adc7854 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-2023 the original author or authors. + * Copyright 2011-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. 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 84b8a4570c..fe964dd947 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-2023 the original author or authors. + * Copyright 2015-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. 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 549ccdf11c..5a33c06642 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-2023 the original author or authors. + * Copyright 2011-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. 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 b80989e887..3da38d5cad 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-2023 the original author or authors. + * Copyright 2011-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. 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 4b25f553da..083e386575 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-2023 the original author or authors. + * Copyright 2022-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. 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 3862985bb8..bddd817e0a 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-2023 the original author or authors. + * Copyright 2022-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. 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 19c05a3385..a706af4a09 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-2023 the original author or authors. + * Copyright 2022-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. 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 e06265dbeb..a40045f274 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-2023 the original author or authors. + * Copyright 2022-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. 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 24d445f515..d3f2a080d4 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-2023 the original author or authors. + * Copyright 2011-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. 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 5164e22495..4250560c0a 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-2023 the original author or authors. + * Copyright 2016-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. 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 4f29335d5b..b7c30dc1b7 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-2023 the original author or authors. + * Copyright 2011-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. 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 6e7b4c3e69..d719b05fb2 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-2023 the original author or authors. + * Copyright 2011-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. 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 5b759f88a0..9c429debac 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-2023 the original author or authors. + * Copyright 2011-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. 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 d4c7a5b522..a65b1e200c 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-2023 the original author or authors. + * Copyright 2022-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. 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 e62599edd1..b9d03ab655 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-2023 the original author or authors. + * Copyright 2011-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. 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 8efbe822ba..b589c99163 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-2023 the original author or authors. + * Copyright 2018-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. 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 d045407e85..b11d7c6657 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-2023 the original author or authors. + * Copyright 2011-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. 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 2cc68ff111..724cb5cd11 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-2023 the original author or authors. + * Copyright 2011-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. 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 b15f60f0ad..686b285f66 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-2023 the original author or authors. + * Copyright 2011-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. 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 58dce55e83..cdd8c26f1f 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-2023 the original author or authors. + * Copyright 2011-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. 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 5143128bdb..833ca61620 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-2023 the original author or authors. + * Copyright 2015-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. diff --git a/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java new file mode 100644 index 0000000000..1f5fe55704 --- /dev/null +++ b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java @@ -0,0 +1,35 @@ +/* + * Copyright 2016-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.core; + +import java.beans.PropertyEditorSupport; + +/** + * PropertyEditor allowing for easy injection of {@link ClusterOperations} from {@link RedisOperations}. + * + * @author Mark Paluch + */ +class ClusterOperationsEditor extends PropertyEditorSupport { + + public void setValue(Object value) { + + if (value instanceof RedisOperations redisOperations) { + super.setValue(redisOperations.opsForCluster()); + } else { + throw new IllegalArgumentException("Editor supports only conversion of type " + RedisOperations.class); + } + } +} 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 765a9f97b5..e80ea71d1a 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-2023 the original author or authors. + * Copyright 2014-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. @@ -69,6 +69,12 @@ public void close() { } @Override + public CursorId getId() { + return delegate.getId(); + } + + @Override + @Deprecated public long getCursorId() { return delegate.getCursorId(); } 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 d960936eee..fa60b0e489 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-2023 the original author or authors. + * Copyright 2014-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. @@ -16,6 +16,7 @@ package org.springframework.data.redis.core; import org.springframework.data.util.CloseableIterator; +import org.springframework.util.Assert; /** * Cursor abstraction to scan over the keyspace or elements within a data structure using a variant of a {@code SCAN} @@ -35,12 +36,22 @@ */ public interface Cursor extends CloseableIterator { + /** + * Returns the reference cursor. + * + * @return the reference cursor. + * @since 3.2.1 + */ + CursorId getId(); + /** * Get the reference cursor.
* NOTE: the id might change while iterating items. * * @return + * @deprecated since 3.3.0, use {@link #getId()} instead as the cursorId can exceed {@link Long#MAX_VALUE}. */ + @Deprecated(since = "3.3.0") long getCursorId(); /** @@ -52,4 +63,112 @@ public interface Cursor extends CloseableIterator { * @return the current position of the cursor. */ long getPosition(); + + /** + * Value class representing a cursor identifier. + * + * @since 3.2.1 + */ + abstract class CursorId { + + private final static CursorId INITIAL = new CursorId() { + @Override + public String getCursorId() { + return "0"; + } + }; + + /** + * Creates a new initial {@link CursorId}. + * + * @return an initial {@link CursorId}. + */ + public static CursorId initial() { + return INITIAL; + } + + /** + * Creates a {@link CursorId} from the given {@code cursorId}. + * + * @param cursorId the provided cursor identifier. + * @return the provided cursor Id. + */ + public static CursorId of(String cursorId) { + + Assert.notNull(cursorId, "CursorId must not be null"); + + if (INITIAL.getCursorId().equals(cursorId)) { + return INITIAL; + } + + return new CursorId() { + + @Override + public String getCursorId() { + return cursorId; + } + }; + } + + /** + * Creates a {@link CursorId} from the given {@code cursorId}. + * + * @param cursorId the provided cursor identifier. + * @return the provided cursor Id. + */ + public static CursorId of(long cursorId) { + + if (cursorId == 0) { + return INITIAL; + } + return of(Long.toUnsignedString(cursorId)); + } + + /** + * Returns whether the given {@code cursorId} represent an initial cursor identifier to indicate an initial/finished + * cursor state. + * + * @param cursorId the cursor identifier to inspect. + * @return {@code true} if the cursorId represents an initial/finished state. + */ + public static boolean isInitial(String cursorId) { + return INITIAL.getCursorId().equals(cursorId); + } + + /** + * Returns whether the current cursor identifier represent an initial cursor identifier to indicate an + * initial/finished cursor state. + * + * @return {@code true} if the cursorId represents an initial/finished state. + */ + public boolean isInitial() { + return INITIAL.getCursorId().equals(getCursorId()); + } + + /** + * @return the raw cursor Id. + */ + public abstract String getCursorId(); + + @Override + public int hashCode() { + return getCursorId().hashCode(); + } + + @Override + public boolean equals(Object obj) { + + if (obj instanceof CursorId other) { + return getCursorId().equals(other.getCursorId()); + } + + return false; + } + + @Override + public String toString() { + return getCursorId(); + } + + } } 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 00e2c2d33a..77a285ae0f 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-2023 the original author or authors. + * Copyright 2015-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. 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 456a339fd0..e451cf97d7 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-2023 the original author or authors. + * Copyright 2016-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. 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 51aa578f34..1bfb9c3467 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-2023 the original author or authors. + * Copyright 2011-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. 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 e62b1ae8db..41d8dc0406 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-2023 the original author or authors. + * Copyright 2014-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. 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 35419994cb..61855b8b0d 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-2023 the original author or authors. + * Copyright 2011-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. 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 60f0ca6e1f..12192babd2 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-2023 the original author or authors. + * 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. 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 b1fd142b8c..fec1f2e7e1 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-2023 the original author or authors. + * 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. 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 4c3258a2eb..d9c3516741 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-2023 the original author or authors. + * 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. 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 cf863e7839..74297cd674 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-2023 the original author or authors. + * 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. 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 63dc0debae..13b546689e 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-2023 the original author or authors. + * 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. 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 139bb2799e..432cf77283 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-2023 the original author or authors. + * Copyright 2018-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. 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 dd59f5bd18..0f0ac35200 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-2023 the original author or authors. + * 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. 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 469264ccd9..40869055e1 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-2023 the original author or authors. + * 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. 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 1e95a24b70..5949af8d73 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-2023 the original author or authors. + * Copyright 2011-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. 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 724460801b..52eaa318ae 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-2023 the original author or authors. + * Copyright 2018-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. 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 ea24a13b91..c26cdbe912 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-2023 the original author or authors. + * Copyright 2011-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. 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 149543027f..9938d5a0ec 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-2023 the original author or authors. + * Copyright 2011-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. 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 cc663f21f5..059f746707 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-2023 the original author or authors. + * Copyright 2011-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. 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 caba07e066..f06f2a88fc 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-2023 the original author or authors. + * Copyright 2016-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. 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 27b085eeeb..c55b5f55ab 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-2023 the original author or authors. + * Copyright 2016-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. 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 6ff90bf2bd..2b1b77547d 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-2023 the original author or authors. + * Copyright 2018-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. 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 432ecbfe2f..8e98e49f97 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-2023 the original author or authors. + * Copyright 2011-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. 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 17eaa7a4cc..30d31d81f2 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-2023 the original author or authors. + * Copyright 2011-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. 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 e5f07c87d0..0c16fa1be4 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-2023 the original author or authors. + * Copyright 2014-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. diff --git a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java new file mode 100644 index 0000000000..abf47663bc --- /dev/null +++ b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java @@ -0,0 +1,35 @@ +/* + * Copyright 2016-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.core; + +import java.beans.PropertyEditorSupport; + +/** + * PropertyEditor allowing for easy injection of {@link HyperLogLogOperations} from {@link RedisOperations}. + * + * @author Mark Paluch + */ +class HyperLogLogOperationsEditor extends PropertyEditorSupport { + + public void setValue(Object value) { + + if (value instanceof RedisOperations redisOperations) { + super.setValue(redisOperations.opsForHyperLogLog()); + } else { + throw new IllegalArgumentException("Editor supports only conversion of type " + RedisOperations.class); + } + } +} 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 1cb2d7ba91..a7f1cf5f60 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-2023 the original author or authors. + * Copyright 2015-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. 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 0a9d79836e..2cc66d5d79 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-2023 the original author or authors. + * Copyright 2014-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. @@ -31,17 +31,36 @@ public abstract class KeyBoundCursor extends ScanCursor { * * @param cursorId * @param options Defaulted to {@link ScanOptions#NONE} if nulled. + * @deprecated since 3.3.0 - Use {@link KeyBoundCursor#KeyBoundCursor(byte[], CursorId, ScanOptions)} instead. */ + @Deprecated(since = "3.3.0") public KeyBoundCursor(byte[] key, long cursorId, @Nullable ScanOptions options) { super(cursorId, options != null ? options : ScanOptions.NONE); this.key = key; } + /** + * Crates new {@link ScanCursor} + * + * @param cursorId + * @param options Defaulted to {@link ScanOptions#NONE} if nulled. + * @since 3.3.0 + */ + public KeyBoundCursor(byte[] key, CursorId cursorId, @Nullable ScanOptions options) { + super(cursorId, options != null ? options : ScanOptions.NONE); + this.key = key; + } + + @Override protected ScanIteration doScan(long cursorId, ScanOptions options) { + return doScan(CursorId.of(cursorId), options); + } + + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { return doScan(this.key, cursorId, options); } - protected abstract ScanIteration doScan(byte[] key, long cursorId, ScanOptions options); + protected abstract ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options); public byte[] getKey() { return key; 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 1f114877f1..0cbb843732 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-2023 the original author or authors. + * Copyright 2014-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. 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 b838754b50..f5c8948385 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-2023 the original author or authors. + * Copyright 2011-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. 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 f556f7c2dc..cf8fc18daa 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-2023 the original author or authors. + * Copyright 2011-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. 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 58bd0efb57..f516b1f65f 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-2023 the original author or authors. + * Copyright 2016-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. 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 99974cac70..76471777ae 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-2023 the original author or authors. + * 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. 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 9516bdc508..0f2950654a 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-2023 the original author or authors. + * 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. 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 d19da8fd66..e0ed1f6148 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-2023 the original author or authors. + * 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. 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 0273ab292e..6a701c2eac 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-2023 the original author or authors. + * 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. 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 0699827c0b..3a22e9a771 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-2023 the original author or authors. + * 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. 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 8424daf4aa..c02d1eea81 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-2023 the original author or authors. + * 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. @@ -103,10 +103,16 @@ public interface ReactiveRedisOperations { /** * Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param channels must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ default Flux> listenToChannel(String... channels) { @@ -118,10 +124,16 @@ default Flux> listenToChannel(String... channels) { /** * Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for * those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param patterns must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ default Flux> listenToPattern(String... patterns) { @@ -132,16 +144,27 @@ default Flux> listenToPattern(String... patterns) { /** * Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for * those. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param topics must not be {@literal null}. * @return a hot sequence of {@link Message messages}. * @since 2.1 + * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer */ Flux> listenTo(Topic... topics); /** * Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. The * {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param channels must not be {@literal null}. * @return a hot sequence of {@link Message messages}. @@ -158,6 +181,11 @@ default Mono>> listenToChannelLater(String... /** * Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for * those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param patterns must not be {@literal null}. * @return a hot sequence of {@link Message messages}. @@ -173,6 +201,11 @@ default Mono>> listenToPatternLater(String... /** * Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for * those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered. + *

+ * Note that this method allocates a new + * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated + * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that + * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly. * * @param topics must not be {@literal null}. * @return a hot sequence of {@link Message messages}. 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 b71e31bfab..3511b7ed02 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-2023 the original author or authors. + * Copyright 2021-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. 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 5d52051a2a..7816a744a8 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-2023 the original author or authors. + * 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. 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 f8d0feff61..eb9e55e431 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-2023 the original author or authors. + * 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. 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 73bf8f0d25..fc3ca29651 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-2023 the original author or authors. + * Copyright 2018-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. 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 1c03c07920..a5a915e6e7 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-2023 the original author or authors. + * 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. 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 be8a0c0fbe..2a0f44404c 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-2023 the original author or authors. + * 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. 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 1416b92c7e..552f008c24 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-2023 the original author or authors. + * 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. 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 c326f2b9ec..09c8decc24 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-2023 the original author or authors. + * Copyright 2011-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. 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 1faadc0c48..0c40d0702b 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-2023 the original author or authors. + * Copyright 2011-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. 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 0814716e62..b9ac36c83d 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-2023 the original author or authors. + * Copyright 2015-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. 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 12da22abac..5621a216d9 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-2023 the original author or authors. + * Copyright 2014-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. 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 0502843817..20e4954ae0 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-2023 the original author or authors. + * Copyright 2011-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. @@ -32,6 +32,7 @@ import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.Assert; +import org.springframework.util.ReflectionUtils; /** * Helper class that provides static methods for obtaining {@link RedisConnection} from a @@ -320,8 +321,8 @@ private static RedisConnection getTargetConnection(RedisConnection connection) { */ public static void unbindConnection(RedisConnectionFactory factory) { - RedisConnectionHolder connectionHolder = - (RedisConnectionHolder) TransactionSynchronizationManager.getResource(factory); + RedisConnectionHolder connectionHolder = (RedisConnectionHolder) TransactionSynchronizationManager + .getResource(factory); if (connectionHolder == null) { return; @@ -358,7 +359,8 @@ public static void unbindConnection(RedisConnectionFactory factory) { * @param connectionFactory Redis connection factory that the connection was created with * @return whether the connection is transactional or not */ - public static boolean isConnectionTransactional(RedisConnection connection, RedisConnectionFactory connectionFactory) { + public static boolean isConnectionTransactional(RedisConnection connection, + RedisConnectionFactory connectionFactory) { Assert.notNull(connectionFactory, "No RedisConnectionFactory specified"); @@ -448,9 +450,16 @@ public void afterCompletion(int status) { static class ConnectionSplittingInterceptor implements MethodInterceptor { private final RedisConnectionFactory factory; + private final @Nullable Method commandInterfaceMethod; public ConnectionSplittingInterceptor(RedisConnectionFactory factory) { this.factory = factory; + this.commandInterfaceMethod = null; + } + + private ConnectionSplittingInterceptor(RedisConnectionFactory factory, Method commandInterfaceMethod) { + this.factory = factory; + this.commandInterfaceMethod = commandInterfaceMethod; } @Override @@ -465,6 +474,22 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab return obj; } + Class returnType = method.getReturnType(); + String returnTypeName = returnType.getSimpleName(); + + // bridge keyCommands etc. to defer target invocations + if (returnType.isInterface() && returnType.getPackageName().equals("org.springframework.data.redis.connection") + && returnTypeName.startsWith("Redis") && returnTypeName.endsWith("Commands")) { + + ProxyFactory proxyFactory = new ProxyFactory(ReflectionUtils.invokeMethod(method, obj)); + + proxyFactory.addAdvice(new ConnectionSplittingInterceptor(factory, method)); + proxyFactory.addInterface(RedisConnectionProxy.class); + proxyFactory.addInterface(returnType); + + return proxyFactory.getProxy(); + } + RedisCommand commandToExecute = RedisCommand.failsafeCommandLookup(method.getName()); if (isPotentiallyThreadBoundCommand(commandToExecute)) { @@ -481,9 +506,15 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab } RedisConnection connection = factory.getConnection(); - + Object target = connection; try { - return invoke(method, connection, args); + + if (commandInterfaceMethod != null) { + target = ReflectionUtils.invokeMethod(commandInterfaceMethod, + connection); + } + + return invoke(method, target, args); } finally { // properly close the unbound connection after executing command if (!connection.isClosed()) { 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 2d9a098b98..b0cb2a1ea1 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-2023 the original author or authors. + * Copyright 2015-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. 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 8405e9b1d7..a57f5fee93 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-2023 the original author or authors. + * Copyright 2015-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. 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 76d9439207..6aaabbe156 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-2023 the original author or authors. + * Copyright 2015-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. 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 acda71c7ce..edbe5c2ff6 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-2023 the original author or authors. + * Copyright 2015-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. 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 7e9af02b1e..3a5b6b342f 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-2023 the original author or authors. + * Copyright 2015-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. 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 41aabae108..7128522447 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-2023 the original author or authors. + * Copyright 2011-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. 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 82d8da2a14..07b946d2b9 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-2023 the original author or authors. + * Copyright 2015-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. @@ -20,8 +20,10 @@ import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.springframework.data.geo.Circle; import org.springframework.data.geo.GeoResult; @@ -31,10 +33,15 @@ import org.springframework.data.keyvalue.core.SortAccessor; import org.springframework.data.keyvalue.core.SpelSortAccessor; import org.springframework.data.keyvalue.core.query.KeyValueQuery; +import org.springframework.data.mapping.PersistentPropertyPath; +import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation; import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs; +import org.springframework.data.redis.connection.util.ByteArrayWrapper; import org.springframework.data.redis.core.convert.GeoIndexedPropertyValue; +import org.springframework.data.redis.core.convert.RedisConverter; import org.springframework.data.redis.core.convert.RedisData; +import org.springframework.data.redis.core.mapping.RedisPersistentProperty; import org.springframework.data.redis.repository.query.RedisOperationChain; import org.springframework.data.redis.repository.query.RedisOperationChain.NearPath; import org.springframework.data.redis.repository.query.RedisOperationChain.PathAndValue; @@ -48,6 +55,7 @@ * * @author Christoph Strobl * @author Mark Paluch + * @author Junghoon Ban * @since 1.7 */ class RedisQueryEngine extends QueryEngine> { @@ -73,7 +81,7 @@ private RedisQueryEngine(CriteriaAccessor criteriaAccessor, @Override @SuppressWarnings("unchecked") - public Collection execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, + public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, String keyspace, Class type) { List result = doFind(criteria, offset, rows, keyspace, type); @@ -89,48 +97,26 @@ private List doFind(RedisOperationChain criteria, long offset, int rows, if (criteria == null || (CollectionUtils.isEmpty(criteria.getOrSismember()) && CollectionUtils.isEmpty(criteria.getSismember())) && criteria.getNear() == null) { - return getAdapter().getAllOf(keyspace, type, offset, rows); + return getRequiredAdapter().getAllOf(keyspace, type, offset, rows); } RedisCallback>> callback = connection -> { - List allKeys = new ArrayList<>(); - if (!criteria.getSismember().isEmpty()) { - allKeys.addAll(connection.sInter(keys(keyspace + ":", criteria.getSismember()))); - } - - if (!criteria.getOrSismember().isEmpty()) { - allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember()))); - } - - if (criteria.getNear() != null) { - - GeoRadiusCommandArgs limit = GeoRadiusCommandArgs.newGeoRadiusArgs(); - - if (rows > 0) { - limit = limit.limit(rows); - } - - GeoResults> x = connection.geoRadius(geoKey(keyspace + ":", criteria.getNear()), - new Circle(criteria.getNear().getPoint(), criteria.getNear().getDistance()), limit); - for (GeoResult> y : x) { - allKeys.add(y.getContent().getName()); - } - } - - byte[] keyspaceBin = getAdapter().getConverter().getConversionService().convert(keyspace + ":", byte[].class); + List keys = findKeys(criteria, rows, keyspace, type, connection); + byte[] keyspaceBin = getRequiredAdapter().getConverter().getConversionService().convert(keyspace + ":", + byte[].class); Map> rawData = new LinkedHashMap<>(); - if (allKeys.isEmpty() || allKeys.size() < offset) { + if (keys.isEmpty() || keys.size() < offset) { return Collections.emptyMap(); } int offsetToUse = Math.max(0, (int) offset); if (rows > 0) { - allKeys = allKeys.subList(Math.max(0, offsetToUse), Math.min(offsetToUse + rows, allKeys.size())); + keys = keys.subList(Math.max(0, offsetToUse), Math.min(offsetToUse + rows, keys.size())); } - for (byte[] id : allKeys) { + for (byte[] id : keys) { byte[] singleKey = ByteUtils.concat(keyspaceBin, id); rawData.put(id, connection.hGetAll(singleKey)); @@ -139,7 +125,7 @@ private List doFind(RedisOperationChain criteria, long offset, int rows, return rawData; }; - Map> raw = this.getAdapter().execute(callback); + Map> raw = this.getRequiredAdapter().execute(callback); List result = new ArrayList<>(raw.size()); for (Map.Entry> entry : raw.entrySet()) { @@ -149,18 +135,71 @@ private List doFind(RedisOperationChain criteria, long offset, int rows, } RedisData data = new RedisData(entry.getValue()); - data.setId(getAdapter().getConverter().getConversionService().convert(entry.getKey(), String.class)); + data.setId(getRequiredAdapter().getConverter().getConversionService().convert(entry.getKey(), String.class)); data.setKeyspace(keyspace); - T converted = this.getAdapter().getConverter().read(type, data); + T converted = this.getRequiredAdapter().getConverter().read(type, data); result.add(converted); } return result; } + private List findKeys(RedisOperationChain criteria, int rows, String keyspace, Class domainType, + RedisConnection connection) { + + List allKeys = new ArrayList<>(); + + if (!criteria.getSismember().isEmpty()) { + + Set sismember = criteria.getSismember(); + if (sismember.size() == 1) { + KeySelector keySelector = KeySelector.of(getRequiredAdapter().getConverter(), sismember, domainType); + if (!keySelector.setValueLookup().isEmpty()) { + allKeys.addAll(connection.sInter(keys(keyspace + ":", keySelector.setValueLookup()))); + } + + allKeys.addAll(keySelector.keys()); + } else { + allKeys.addAll(connection.sInter(keys(keyspace + ":", sismember))); + } + } + + KeySelector keySelector = KeySelector.of(getRequiredAdapter().getConverter(), criteria.getOrSismember(), + domainType); + + if (!keySelector.setValueLookup().isEmpty()) { + allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember()))); + } + + allKeys.addAll(keySelector.keys()); + + if (criteria.getNear() != null) { + + GeoRadiusCommandArgs limit = GeoRadiusCommandArgs.newGeoRadiusArgs(); + + if (rows > 0) { + limit = limit.limit(rows); + } + + GeoResults> x = connection.geoRadius(geoKey(keyspace + ":", criteria.getNear()), + new Circle(criteria.getNear().getPoint(), criteria.getNear().getDistance()), limit); + for (GeoResult> y : x) { + allKeys.add(y.getContent().getName()); + } + } + + Set unique = new LinkedHashSet<>(allKeys.size()); + allKeys.forEach(key -> unique.add(new ByteArrayWrapper(key))); + + List uniqueKeys = new ArrayList<>(unique.size()); + unique.forEach(key -> uniqueKeys.add(key.getArray())); + + return uniqueKeys; + } + @Override - public Collection execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, + public List execute(RedisOperationChain criteria, Comparator sort, long offset, int rows, String keyspace) { return execute(criteria, sort, offset, rows, keyspace, Object.class); } @@ -169,10 +208,10 @@ public Collection execute(RedisOperationChain criteria, Comparator sort, l public long count(RedisOperationChain criteria, String keyspace) { if (criteria == null || criteria.isEmpty()) { - return this.getAdapter().count(keyspace); + return this.getRequiredAdapter().count(keyspace); } - return this.getAdapter().execute(connection -> { + return this.getRequiredAdapter().execute(connection -> { long result = 0; @@ -194,9 +233,9 @@ private byte[][] keys(String prefix, Collection source) { int i = 0; for (PathAndValue pathAndValue : source) { - byte[] convertedValue = getAdapter().getConverter().getConversionService().convert(pathAndValue.getFirstValue(), - byte[].class); - byte[] fullPath = getAdapter().getConverter().getConversionService() + byte[] convertedValue = getRequiredAdapter().getConverter().getConversionService() + .convert(pathAndValue.getFirstValue(), byte[].class); + byte[] fullPath = getRequiredAdapter().getConverter().getConversionService() .convert(prefix + pathAndValue.getPath() + ":", byte[].class); keys[i] = ByteUtils.concat(fullPath, convertedValue); @@ -208,7 +247,7 @@ private byte[][] keys(String prefix, Collection source) { private byte[] geoKey(String prefix, NearPath source) { String path = GeoIndexedPropertyValue.geoIndexName(source.getPath()); - return getAdapter().getConverter().getConversionService().convert(prefix + path, byte[].class); + return getRequiredAdapter().getConverter().getConversionService().convert(prefix + path, byte[].class); } @@ -223,4 +262,35 @@ public RedisOperationChain resolve(KeyValueQuery query) { return (RedisOperationChain) query.getCriteria(); } } + + /** + * Value object capturing the direct object keys and set of values that need to be looked up from the secondary + * indexes. + * + * @param keys + * @param setValueLookup + * @since 3.2.4 + */ + record KeySelector(Collection keys, Set setValueLookup) { + + static KeySelector of(RedisConverter converter, Set pathAndValues, Class domainType) { + + Set keys = new LinkedHashSet<>(); + Set remainder = new LinkedHashSet<>(); + + for (PathAndValue pathAndValue : pathAndValues) { + + PersistentPropertyPath path = converter.getMappingContext() + .getPersistentPropertyPath(pathAndValue.getPath(), domainType); + if (path.getLeafProperty().isIdProperty()) { + byte[] key = converter.getConversionService().convert(pathAndValue.getFirstValue(), byte[].class); + keys.add(key); + } else { + remainder.add(pathAndValue); + } + } + + return new KeySelector(keys, remainder); + } + } } 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 e0be526eb1..93ee4ca0de 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-2023 the original author or authors. + * Copyright 2011-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. @@ -129,8 +129,6 @@ public void afterPropertiesSet() { super.afterPropertiesSet(); - boolean defaultUsed = false; - if (defaultSerializer == null) { defaultSerializer = new JdkSerializationRedisSerializer( @@ -141,26 +139,18 @@ public void afterPropertiesSet() { if (keySerializer == null) { keySerializer = defaultSerializer; - defaultUsed = true; } if (valueSerializer == null) { valueSerializer = defaultSerializer; - defaultUsed = true; } if (hashKeySerializer == null) { hashKeySerializer = defaultSerializer; - defaultUsed = true; } if (hashValueSerializer == null) { hashValueSerializer = defaultSerializer; - defaultUsed = true; } } - if (enableDefaultSerializer && defaultUsed) { - Assert.notNull(defaultSerializer, "default serializer null and not all serializers initialized"); - } - if (scriptExecutor == null) { this.scriptExecutor = new DefaultScriptExecutor<>(this); } 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 1b5729dcf6..8c94ff726b 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-2023 the original author or authors. + * Copyright 2014-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. @@ -40,51 +40,76 @@ public abstract class ScanCursor implements Cursor { private CursorState state; - private long cursorId; + private CursorId id; private Iterator delegate; private final ScanOptions scanOptions; private long position; /** - * Crates new {@link ScanCursor} with {@code id=0} and {@link ScanOptions#NONE} + * Crates new {@link ScanCursor} with an initial cursor and {@link ScanOptions#NONE} */ public ScanCursor() { this(ScanOptions.NONE); } /** - * Crates new {@link ScanCursor} with {@code id=0}. + * Crates new {@link ScanCursor} with an initial cursor. * * @param options the scan options to apply. */ public ScanCursor(ScanOptions options) { - this(0, options); + this(CursorId.initial(), options); } /** * Crates new {@link ScanCursor} with {@link ScanOptions#NONE} * * @param cursorId the cursor Id. + * @deprecated since 3.3.0 - Use {@link ScanCursor#ScanCursor(CursorId)} instead. */ + @Deprecated(since = "3.3.0") public ScanCursor(long cursorId) { this(cursorId, ScanOptions.NONE); } + /** + * Crates new {@link ScanCursor} with {@link ScanOptions#NONE} + * + * @param cursorId the cursor Id. + * @since 3.3.0 + */ + public ScanCursor(CursorId cursorId) { + this(cursorId, ScanOptions.NONE); + } + /** * Crates new {@link ScanCursor} * * @param cursorId the cursor Id. * @param options Defaulted to {@link ScanOptions#NONE} if {@code null}. + * @deprecated since 3.3.0 - Use {@link ScanCursor#ScanCursor(CursorId, ScanOptions)} instead. */ + @Deprecated(since = "3.3.0") public ScanCursor(long cursorId, @Nullable ScanOptions options) { + this(CursorId.of(cursorId), options); + } + + /** + * Crates new {@link ScanCursor} + * + * @param cursorId the cursor Id. + * @param options Defaulted to {@link ScanOptions#NONE} if {@code null}. + * @since 3.3.0 + */ + public ScanCursor(CursorId cursorId, @Nullable ScanOptions options) { this.scanOptions = options != null ? options : ScanOptions.NONE; - this.cursorId = cursorId; + this.id = cursorId; this.state = CursorState.READY; this.delegate = Collections.emptyIterator(); } - private void scan(long cursorId) { + private void scan(CursorId cursorId) { try { processScanResult(doScan(cursorId, this.scanOptions)); @@ -105,8 +130,25 @@ private void scan(long cursorId) { * @param cursorId * @param options * @return + * @deprecated since 3.3.0, cursorId, can exceed {@link Long#MAX_VALUE}. */ - protected abstract ScanIteration doScan(long cursorId, ScanOptions options); + @Deprecated(since = "3.3.0") + protected ScanIteration doScan(long cursorId, ScanOptions options) { + return doScan(CursorId.of(cursorId), scanOptions); + } + + /** + * Performs the actual scan command using the native client implementation. The given {@literal options} are never + * {@code null}. + * + * @param cursorId + * @param options + * @return + * @since 3.3.0 + */ + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { + return doScan(Long.parseLong(cursorId.getCursorId()), scanOptions); + } /** * Initialize the {@link Cursor} prior to usage. @@ -118,7 +160,7 @@ public final ScanCursor open() { } state = CursorState.OPEN; - doOpen(cursorId); + doOpen(getId()); return this; } @@ -127,16 +169,27 @@ public final ScanCursor open() { * Customization hook when calling {@link #open()}. * * @param cursorId + * @deprecated since 3.3.0, use {@link #doOpen(CursorId)} instead. */ + @Deprecated(since = "3.3.0", forRemoval = true) protected void doOpen(long cursorId) { + doOpen(CursorId.of(cursorId)); + } + + /** + * Customization hook when calling {@link #open()}. + * + * @param cursorId + */ + protected void doOpen(CursorId cursorId) { scan(cursorId); } private void processScanResult(ScanIteration result) { - cursorId = result.getCursorId(); + id = result.getId(); - if (isFinished(cursorId)) { + if (isFinished(id)) { state = CursorState.FINISHED; } @@ -154,17 +207,34 @@ private void processScanResult(ScanIteration result) { * @return {@literal true} if the cursor is considered finished, {@literal false} otherwise.s * @since 2.1 */ + @Deprecated(since = "3.3.0", forRemoval = true) protected boolean isFinished(long cursorId) { return cursorId == 0; } + /** + * Check whether {@code cursorId} is finished. + * + * @param cursorId the cursor Id + * @return {@literal true} if the cursor is considered finished, {@literal false} otherwise.s + * @since 3.3.0 + */ + protected boolean isFinished(CursorId cursorId) { + return CursorId.isInitial(cursorId.getCursorId()); + } + private void resetDelegate() { delegate = Collections.emptyIterator(); } + @Override + public CursorId getId() { + return id; + } + @Override public long getCursorId() { - return cursorId; + return Long.parseUnsignedLong(getId().getCursorId()); } @Override @@ -173,14 +243,14 @@ public boolean hasNext() { assertCursorIsOpen(); while (!delegate.hasNext() && !CursorState.FINISHED.equals(state)) { - scan(cursorId); + scan(getId()); } if (delegate.hasNext()) { return true; } - return cursorId > 0; + return !isFinished(id); } private void assertCursorIsOpen() { @@ -196,7 +266,7 @@ public T next() { assertCursorIsOpen(); if (!hasNext()) { - throw new NoSuchElementException("No more elements available for cursor " + cursorId); + throw new NoSuchElementException("No more elements available for cursor " + id); } T next = moveNext(delegate); 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 f36f08746b..1be8cf8771 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-2023 the original author or authors. + * Copyright 2014-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. @@ -15,6 +15,8 @@ */ package org.springframework.data.redis.core; +import static org.springframework.data.redis.core.Cursor.*; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -32,14 +34,26 @@ */ public class ScanIteration implements Iterable { - private final long cursorId; + private final CursorId cursorId; private final Collection items; /** * @param cursorId * @param items + * @deprecated since 3.3.0, use {@link ScanIteration#ScanIteration(CursorId, Collection)} instead as {@code cursorId} + * can exceed {@link Long#MAX_VALUE}. */ + @Deprecated(since = "3.3.0") public ScanIteration(long cursorId, @Nullable Collection items) { + this(CursorId.of(cursorId), items); + } + + /** + * @param cursorId + * @param items + * @since 3.3.0 + */ + public ScanIteration(CursorId cursorId, @Nullable Collection items) { this.cursorId = cursorId; this.items = (items != null ? new ArrayList<>(items) : Collections.emptyList()); @@ -49,8 +63,20 @@ public ScanIteration(long cursorId, @Nullable Collection items) { * The cursor id to be used for subsequent requests. * * @return + * @deprecated since 3.3.0, use {@link #getId()} instead as the cursorId can exceed {@link Long#MAX_VALUE}. */ + @Deprecated(since="3.3.3") public long getCursorId() { + return Long.parseLong(getId().getCursorId()); + } + + /** + * The cursor id to be used for subsequent requests. + * + * @return + * @since 3.3.0 + */ + public CursorId getId() { return cursorId; } 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 20d47e236a..959aa9aaea 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-2023 the original author or authors. + * Copyright 2014-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. 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 70ffbdbbc7..0d41a5299f 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-2023 the original author or authors. + * Copyright 2011-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. 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 4b155aaa5a..00471359d3 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-2023 the original author or authors. + * Copyright 2011-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. 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 ab087affa5..cad663aff8 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-2023 the original author or authors. + * Copyright 2011-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. 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 9de0735438..d8e340f330 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-2023 the original author or authors. + * Copyright 2018-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. 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 0a258aa8a7..4636c5bcf6 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-2023 the original author or authors. + * Copyright 2018-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. diff --git a/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.java new file mode 100644 index 0000000000..5776342b2c --- /dev/null +++ b/src/main/java/org/springframework/data/redis/core/StreamOperationsEditor.java @@ -0,0 +1,35 @@ +/* + * Copyright 2016-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.core; + +import java.beans.PropertyEditorSupport; + +/** + * PropertyEditor allowing for easy injection of {@link StreamOperations} from {@link RedisOperations}. + * + * @author Mark Paluch + */ +class StreamOperationsEditor extends PropertyEditorSupport { + + public void setValue(Object value) { + + if (value instanceof RedisOperations redisOperations) { + super.setValue(redisOperations.opsForStream()); + } else { + throw new IllegalArgumentException("Editor supports only conversion of type " + RedisOperations.class); + } + } +} 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 60e2cb2360..072872be57 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-2023 the original author or authors. + * Copyright 2011-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. 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 454200e9c2..bcc148c608 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-2023 the original author or authors. + * Copyright 2015-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. 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 629429e084..0b90a8c973 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-2023 the original author or authors. + * Copyright 2015-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. 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 d6833b46c3..064fda4a8e 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-2023 the original author or authors. + * Copyright 2013-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. 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 edd350457b..546a83f8ff 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-2023 the original author or authors. + * Copyright 2011-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. 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 d10ff0801b..1eaf8949fa 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-2023 the original author or authors. + * Copyright 2011-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. 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 80c8f6812e..e20f560410 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-2023 the original author or authors. + * Copyright 2011-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. 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 50e9f0b557..124eccfd07 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-2023 the original author or authors. + * Copyright 2011-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. 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 f15e0966b5..402a68d7ac 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-2023 the original author or authors. + * Copyright 2015-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. 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 ac2d523c38..3599e8b5ee 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-2023 the original author or authors. + * Copyright 2015-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. 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 d342fb943c..fd6d702cd0 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-2023 the original author or authors. + * Copyright 2016-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. 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 69770adbc6..5896c6ff43 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-2023 the original author or authors. + * 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. 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 7819ea8fcd..979d576a08 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-2023 the original author or authors. + * Copyright 2016-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. 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 9bb26bd27f..95c63c2992 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-2023 the original author or authors. + * Copyright 2015-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. 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 b17c3c9feb..e6c0fce9e5 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-2023 the original author or authors. + * Copyright 2015-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. 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 7b8e8071d8..c9521d0602 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-2023 the original author or authors. + * Copyright 2016-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. 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 07e34ab7d3..d4e874e9e9 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-2023 the original author or authors. + * Copyright 2016-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. 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 9a95fe8884..d3fcd1b5cb 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-2023 the original author or authors. + * Copyright 2015-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. 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 3cdb3f1a2d..a938bbeafa 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-2023 the original author or authors. + * Copyright 2015-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. 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 1b66e53bc3..e9e1a9f312 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-2023 the original author or authors. + * Copyright 2015-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. @@ -16,8 +16,17 @@ package org.springframework.data.redis.core.convert; import java.lang.reflect.Array; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -1046,6 +1055,11 @@ public IndexResolver getIndexResolver() { return this.indexResolver; } + @Override + public EntityInstantiators getEntityInstantiators() { + return entityInstantiators; + } + @Override public ConversionService getConversionService() { return this.conversionService; 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 bcfacf2c88..f23873ee9d 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-2023 the original author or authors. + * Copyright 2015-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. @@ -122,6 +122,7 @@ public void doWithPersistentProperty(RedisPersistentProperty persistentProperty) Object propertyValue = accessor.getProperty(persistentProperty); if (propertyValue == null) { + indexes.addAll(resolveIndex(keyspace, currentPath, persistentProperty, null)); return; } @@ -209,24 +210,25 @@ protected Set resolveIndex(String keyspace, String propertyPath, } Object transformedValue = indexDefinition.valueTransformer().convert(value); + IndexedData indexedData; - IndexedData indexedData = null; if (transformedValue == null) { - indexedData = new RemoveIndexedData(indexedData); + indexedData = new RemoveIndexedData(indexDefinition); } else { indexedData = indexedDataFactoryProvider.getIndexedDataFactory(indexDefinition).createIndexedDataFor(value); } + data.add(indexedData); } } - else if (property != null && property.isAnnotationPresent(Indexed.class)) { + else if (property != null && value != null && property.isAnnotationPresent(Indexed.class)) { SimpleIndexDefinition indexDefinition = new SimpleIndexDefinition(keyspace, path); indexConfiguration.addIndexDefinition(indexDefinition); data.add(indexedDataFactoryProvider.getIndexedDataFactory(indexDefinition).createIndexedDataFor(value)); - } else if (property != null && property.isAnnotationPresent(GeoIndexed.class)) { + } else if (property != null && value != null && property.isAnnotationPresent(GeoIndexed.class)) { GeoIndexDefinition indexDefinition = new GeoIndexDefinition(keyspace, path); indexConfiguration.addIndexDefinition(indexDefinition); 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 ce93708362..998f223233 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-2023 the original author or authors. + * Copyright 2015-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. @@ -16,6 +16,7 @@ package org.springframework.data.redis.core.convert; import org.springframework.data.convert.EntityConverter; +import org.springframework.data.mapping.model.EntityInstantiators; import org.springframework.data.redis.core.mapping.RedisMappingContext; import org.springframework.data.redis.core.mapping.RedisPersistentEntity; import org.springframework.data.redis.core.mapping.RedisPersistentProperty; @@ -40,4 +41,10 @@ public interface RedisConverter */ @Nullable IndexResolver getIndexResolver(); + + /** + * @return the configured {@link EntityInstantiators}. + * @since 3.2.4 + */ + EntityInstantiators getEntityInstantiators(); } 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 5c20f42d7b..5f097242a9 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-2023 the original author or authors. + * 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. 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 febc002350..a571c205f9 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-2023 the original author or authors. + * Copyright 2015-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. 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 de97be1ddb..8f8ba965ab 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-2023 the original author or authors. + * 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. 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 8d7e16bdfe..a68653200c 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-2023 the original author or authors. + * Copyright 2015-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. 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 cd48c42f5c..19ad617332 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-2023 the original author or authors. + * Copyright 2016-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. 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 82c81970b0..fde0d7d740 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-2023 the original author or authors. + * Copyright 2016-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. @@ -15,6 +15,8 @@ */ package org.springframework.data.redis.core.convert; +import org.springframework.data.redis.core.index.IndexDefinition; + /** * {@link RemoveIndexedData} represents a removed index entry from a secondary index for a property path in a given keyspace. * @@ -23,21 +25,20 @@ */ public class RemoveIndexedData implements IndexedData { - private final IndexedData delegate; + private final IndexDefinition indexDefinition; - RemoveIndexedData(IndexedData delegate) { - super(); - this.delegate = delegate; + RemoveIndexedData(IndexDefinition indexDefinition) { + this.indexDefinition = indexDefinition; } @Override public String getIndexName() { - return delegate.getIndexName(); + return indexDefinition.getIndexName(); } @Override public String getKeyspace() { - return delegate.getKeyspace(); + return indexDefinition.getKeyspace(); } @Override 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 f11ad96967..f218e7d07a 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-2023 the original author or authors. + * Copyright 2015-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. 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 f15322582e..a386a29cdc 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-2023 the original author or authors. + * Copyright 2016-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. 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 257c1a4283..d97a686caa 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-2023 the original author or authors. + * Copyright 2016-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. 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 dcf88f8f10..00a7edc640 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-2023 the original author or authors. + * Copyright 2016-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. 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 207fab4960..185b7bd19d 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-2023 the original author or authors. + * Copyright 2016-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. 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 9813dff1e9..12b55bbaf5 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-2023 the original author or authors. + * Copyright 2015-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. 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 2dc1383cb0..86151fc07e 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-2023 the original author or authors. + * Copyright 2016-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. @@ -24,7 +24,7 @@ /** * {@link IndexDefinition} allow to set up a blueprint for creating secondary index structures in Redis. Setting up * conditions allows to define {@link Condition} that have to be passed in order to add a value to the index. This - * allows to fine grained tune the index structure. {@link IndexValueTransformer} gets applied to the raw value for + * allows to fine-grained tune the index structure. {@link IndexValueTransformer} gets applied to the raw value for * creating the actual index entry. * * @author Christoph Strobl 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 5bfa797db6..e4d07547d4 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-2023 the original author or authors. + * Copyright 2016-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. 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 37abe21ad0..8e723ad498 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-2023 the original author or authors. + * Copyright 2016-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. 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 7d4df6a175..13d77f9ee7 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-2023 the original author or authors. + * Copyright 2016-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. 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 58b4851d21..15dc14d3c0 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-2023 the original author or authors. + * Copyright 2015-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. 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 62e1bbb479..9526f279b3 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-2023 the original author or authors. + * Copyright 2016-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. 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 0606f788cc..122659a12c 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-2023 the original author or authors. + * Copyright 2016-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. 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 6108bac15d..5bd19d501d 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-2023 the original author or authors. + * Copyright 2016-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. 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 804b3a5da9..8501e3b1b9 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-2023 the original author or authors. + * Copyright 2016-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. 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 14c49a4572..7c68335874 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-2023 the original author or authors. + * Copyright 2015-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. 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 653d2533fc..e623311ee9 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-2023 the original author or authors. + * Copyright 2015-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. 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 39c2fbe2dd..a31eca7895 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-2023 the original author or authors. + * Copyright 2015-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. 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 d9d0f36858..e607b2aeb7 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-2023 the original author or authors. + * Copyright 2015-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. 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 e8524b1f43..af4c532900 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-2023 the original author or authors. + * Copyright 2011-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. 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 9696875e7f..3746520ce9 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-2023 the original author or authors. + * Copyright 2011-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. 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 77f75ad9bf..dd11c5dfdd 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-2023 the original author or authors. + * Copyright 2011-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. 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 63e69d4275..acb86537a1 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-2023 the original author or authors. + * Copyright 2011-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. 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 4d597407a8..491a9eea30 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-2023 the original author or authors. + * Copyright 2011-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. 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 cf795c395f..2065256b38 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-2023 the original author or authors. + * Copyright 2011-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. 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 a0c446d58a..66c0bb4303 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-2023 the original author or authors. + * 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. 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 2f85690bed..1d7dac0286 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-2023 the original author or authors. + * Copyright 2013-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. 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 b38c91391c..9c96c1671c 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-2023 the original author or authors. + * Copyright 2013-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. 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 60746f4027..d8b4635ca3 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-2023 the original author or authors. + * Copyright 2013-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. 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 20f8503fbc..b9b765d96f 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-2023 the original author or authors. + * 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. 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 b3380a5062..67ec37ed5a 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-2023 the original author or authors. + * Copyright 2013-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. 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 8c215b1504..b7b658a7e4 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-2023 the original author or authors. + * Copyright 2013-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. 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 3d112b7da9..e55dd813b6 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-2023 the original author or authors. + * 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. 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 d981666164..09315fb6a7 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-2023 the original author or authors. + * Copyright 2013-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. 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 c5df3ae8f7..81930db228 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-2023 the original author or authors. + * Copyright 2016-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. 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 04b103a9d3..898c25b180 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-2023 the original author or authors. + * Copyright 2014-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. 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 1881c50831..4d00e271d1 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-2023 the original author or authors. + * Copyright 2021-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. 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 1853dc5e6f..00f410fd37 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-2023 the original author or authors. + * Copyright 2021-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. 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 3ed0eafac6..bd570afab6 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-2023 the original author or authors. + * Copyright 2021-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. 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 a83ec7c8a7..b3d728e0b6 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-2023 the original author or authors. + * Copyright 2021-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. 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 691218c522..c3ddf47818 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-2023 the original author or authors. + * Copyright 2021-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. 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 21079d451d..f79b5983aa 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-2023 the original author or authors. + * Copyright 2021-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. 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 971cf66f38..d8b8213e5a 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-2023 the original author or authors. + * Copyright 2021-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. 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 267cd9891d..ad85827105 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-2023 the original author or authors. + * Copyright 2011-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. 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 bb6b0e4a92..ebbeecfa48 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-2023 the original author or authors. + * Copyright 2011-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. 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 1403f9bf42..d7c8e18b72 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-2023 the original author or authors. + * Copyright 2011-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. 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 245d507b19..e33243b6b0 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-2023 the original author or authors. + * Copyright 2016-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. @@ -436,8 +436,20 @@ private void flattenElement(String propertyPrefix, Object source, Map resultMap.put(propertyPrefix, element.textValue()); + case NUMBER -> resultMap.put(propertyPrefix, element.numberValue()); + case BOOLEAN -> resultMap.put(propertyPrefix, element.booleanValue()); + case BINARY -> { + try { + resultMap.put(propertyPrefix, element.binaryValue()); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + default -> resultMap.put(propertyPrefix, new DirectFieldAccessFallbackBeanWrapper(element).getPropertyValue("_value")); + } } } diff --git a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java index 42cfded388..10aa244ac5 100644 --- a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-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. diff --git a/src/main/java/org/springframework/data/redis/listener/AbstractTopic.java b/src/main/java/org/springframework/data/redis/listener/AbstractTopic.java index 7bc2ee0d4e..8cfc1ca3e6 100644 --- a/src/main/java/org/springframework/data/redis/listener/AbstractTopic.java +++ b/src/main/java/org/springframework/data/redis/listener/AbstractTopic.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-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. diff --git a/src/main/java/org/springframework/data/redis/listener/ChannelTopic.java b/src/main/java/org/springframework/data/redis/listener/ChannelTopic.java index 6b4f09fb84..73eb81a24d 100644 --- a/src/main/java/org/springframework/data/redis/listener/ChannelTopic.java +++ b/src/main/java/org/springframework/data/redis/listener/ChannelTopic.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/main/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListener.java b/src/main/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListener.java index 61039da973..f78981fe2c 100644 --- a/src/main/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListener.java +++ b/src/main/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-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. diff --git a/src/main/java/org/springframework/data/redis/listener/KeyspaceEventMessageListener.java b/src/main/java/org/springframework/data/redis/listener/KeyspaceEventMessageListener.java index eba222f5fd..11e21e49c1 100644 --- a/src/main/java/org/springframework/data/redis/listener/KeyspaceEventMessageListener.java +++ b/src/main/java/org/springframework/data/redis/listener/KeyspaceEventMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-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. diff --git a/src/main/java/org/springframework/data/redis/listener/PatternTopic.java b/src/main/java/org/springframework/data/redis/listener/PatternTopic.java index 65f34c2ecf..efb6fcb257 100644 --- a/src/main/java/org/springframework/data/redis/listener/PatternTopic.java +++ b/src/main/java/org/springframework/data/redis/listener/PatternTopic.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/main/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainer.java index 7a1e8affb4..58903a5a2e 100644 --- a/src/main/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainer.java +++ b/src/main/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-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. @@ -146,7 +146,7 @@ public Collection getActiveSubscriptions() { * * @param channelTopics the channels to subscribe. * @return the message stream. - * @throws InvalidDataAccessApiUsageException if {@code patternTopics} is empty. + * @throws InvalidDataAccessApiUsageException if {@code channelTopics} is empty. * @see #receive(Iterable, SerializationPair, SerializationPair) */ public Flux> receive(ChannelTopic... channelTopics) { @@ -168,7 +168,7 @@ public Flux> receive(ChannelTopic... channelTopics) { * * @param channelTopics the channels to subscribe. * @return the message stream. - * @throws InvalidDataAccessApiUsageException if {@code patternTopics} is empty. + * @throws InvalidDataAccessApiUsageException if {@code channelTopics} is empty. * @since 2.6 */ public Mono>> receiveLater(ChannelTopic... channelTopics) { 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 cc083f14d3..172a3f825d 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-2023 the original author or authors. + * Copyright 2011-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. @@ -370,7 +370,7 @@ private void lazyListen() { State state = this.state.get(); CompletableFuture futureToAwait = state.isPrepareListening() ? containerListenFuture - : lazyListen(this.backOff.start()); + : lazyListen(new InitialBackoffExecution(this.backOff.start())); try { futureToAwait.get(getMaxSubscriptionRegistrationWaitingTime(), TimeUnit.MILLISECONDS); @@ -531,8 +531,7 @@ private void awaitRegistrationTime(CompletableFuture future) { future.get(getMaxSubscriptionRegistrationWaitingTime(), TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); - } catch (ExecutionException | TimeoutException ignore) { - } + } catch (ExecutionException | TimeoutException ignore) {} } @Override @@ -876,7 +875,7 @@ protected void handleSubscriptionException(CompletableFuture future, BackO if (recoveryInterval != BackOffExecution.STOP) { String message = String.format("Connection failure occurred: %s; Restarting subscription task after %s ms", - cause, recoveryInterval); + cause, recoveryInterval); logger.error(message, cause); } @@ -885,8 +884,13 @@ protected void handleSubscriptionException(CompletableFuture future, BackO Runnable recoveryFunction = () -> { - CompletableFuture lazyListen = lazyListen(backOffExecution); - lazyListen.whenComplete(propagate(future)); + CompletableFuture lazyListen = lazyListen(new RecoveryBackoffExecution(backOffExecution)); + lazyListen.whenComplete(propagate(future)).thenRun(() -> { + + if (backOffExecution instanceof RecoveryAfterSubscriptionBackoffExecution) { + logger.info("Subscription(s) recovered"); + } + }); }; if (potentiallyRecover(loggingBackOffExecution, recoveryFunction)) { @@ -980,7 +984,7 @@ private boolean hasTopics() { private Subscriber getRequiredSubscriber() { Assert.state(this.subscriber != null, - "Subscriber not created; Configure RedisConnectionFactory to create a Subscriber"); + "Subscriber not created; Configure RedisConnectionFactory to create a Subscriber. Make sure that afterPropertiesSet() has been called"); return this.subscriber; } @@ -1018,6 +1022,54 @@ private void logTrace(Supplier message) { } } + BackOffExecution nextBackoffExecution(BackOffExecution backOffExecution, boolean subscribed) { + + if (subscribed) { + return new RecoveryAfterSubscriptionBackoffExecution(backOff.start()); + } + + return backOffExecution; + } + + /** + * Marker for an initial backoff. + * + * @param delegate + */ + record InitialBackoffExecution(BackOffExecution delegate) implements BackOffExecution { + + @Override + public long nextBackOff() { + return delegate.nextBackOff(); + } + } + + /** + * Marker for a recovery after a subscription has been active previously. + * + * @param delegate + */ + record RecoveryAfterSubscriptionBackoffExecution(BackOffExecution delegate) implements BackOffExecution { + + @Override + public long nextBackOff() { + return delegate.nextBackOff(); + } + } + + /** + * Marker for a recovery execution. + * + * @param delegate + */ + record RecoveryBackoffExecution(BackOffExecution delegate) implements BackOffExecution { + + @Override + public long nextBackOff() { + return delegate.nextBackOff(); + } + } + /** * Represents an operation that accepts three input arguments {@link SubscriptionListener}, * {@code channel or pattern}, and {@code count} and returns no result. @@ -1191,7 +1243,7 @@ public CompletableFuture initialize(BackOffExecution backOffExecution, Col if (connection.isSubscribed()) { initFuture.completeExceptionally( - new IllegalStateException("Retrieved connection is already subscribed; aborting listening")); + new IllegalStateException("Retrieved connection is already subscribed; aborting listening")); return initFuture; } @@ -1199,10 +1251,15 @@ public CompletableFuture initialize(BackOffExecution backOffExecution, Col try { eventuallyPerformSubscription(connection, backOffExecution, initFuture, patterns, channels); } catch (Throwable t) { - handleSubscriptionException(initFuture, backOffExecution, t); + handleSubscriptionException(initFuture, nextBackoffExecution(backOffExecution, connection.isSubscribed()), + t); } } catch (RuntimeException ex) { - initFuture.completeExceptionally(ex); + if (backOffExecution instanceof InitialBackoffExecution) { + initFuture.completeExceptionally(ex); + } else { + handleSubscriptionException(initFuture, backOffExecution, ex); + } } return initFuture; @@ -1215,8 +1272,9 @@ public CompletableFuture initialize(BackOffExecution backOffExecution, Col void eventuallyPerformSubscription(RedisConnection connection, BackOffExecution backOffExecution, CompletableFuture subscriptionDone, Collection patterns, Collection channels) { - addSynchronization(new SynchronizingMessageListener.SubscriptionSynchronization(patterns, channels, - () -> subscriptionDone.complete(null))); + addSynchronization(new SynchronizingMessageListener.SubscriptionSynchronization(patterns, channels, () -> { + subscriptionDone.complete(null); + })); doSubscribe(connection, patterns, channels); } @@ -1381,7 +1439,10 @@ private void doWithSubscription(byte[][] data, BiConsumer { runner.run(); return null; }); + doInLock(() -> { + runner.run(); + return null; + }); } private T doInLock(Supplier supplier) { @@ -1432,7 +1493,7 @@ protected void eventuallyPerformSubscription(RedisConnection connection, BackOff try { subscribeChannel(channels.toArray(new byte[0][])); } catch (Exception ex) { - handleSubscriptionException(subscriptionDone, backOffExecution, ex); + handleSubscriptionException(subscriptionDone, nextBackoffExecution(backOffExecution, true), ex); } })); } else { @@ -1449,7 +1510,8 @@ protected void eventuallyPerformSubscription(RedisConnection connection, BackOff closeConnection(); unsubscribeFuture.complete(null); } catch (Throwable cause) { - handleSubscriptionException(subscriptionDone, backOffExecution, cause); + handleSubscriptionException(subscriptionDone, + nextBackoffExecution(backOffExecution, connection.isSubscribed()), cause); } }); } 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 878cd447c8..14210d859c 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-2023 the original author or authors. + * Copyright 2022-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. 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 385d3b5bc2..23f9b6f2d3 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-2023 the original author or authors. + * Copyright 2011-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. 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 f652faafd4..2152b4fad9 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-2023 the original author or authors. + * Copyright 2011-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. 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 2523f51ac9..8a07b95c36 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-2023 the original author or authors. + * Copyright 2011-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. 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 a13253738d..bdb9248f6f 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-2023 the original author or authors. + * Copyright 2016-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. 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 0cab13f6c2..9a1a8988b8 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-2023 the original author or authors. + * Copyright 2016-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. 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 e0a3e10238..eb6dc61941 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-2023 the original author or authors. + * Copyright 2016-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. 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 79464735a1..efd211928a 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-2023 the original author or authors. + * Copyright 2016-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. 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 9a345ed837..c445925f6e 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-2023 the original author or authors. + * Copyright 2016-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. 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 90db57c677..eea89db92b 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-2023 the original author or authors. + * Copyright 2015-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. @@ -33,6 +33,7 @@ import org.springframework.data.redis.core.convert.KeyspaceConfiguration; import org.springframework.data.redis.core.index.IndexConfiguration; import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; +import org.springframework.data.redis.repository.query.RedisPartTreeQuery; import org.springframework.data.redis.repository.query.RedisQueryCreator; import org.springframework.data.redis.repository.support.RedisRepositoryFactoryBean; import org.springframework.data.repository.config.DefaultRepositoryBaseClass; @@ -52,7 +53,7 @@ @Documented @Inherited @Import(RedisRepositoriesRegistrar.class) -@QueryCreatorType(RedisQueryCreator.class) +@QueryCreatorType(value = RedisQueryCreator.class, repositoryQueryType = RedisPartTreeQuery.class) public @interface EnableRedisRepositories { /** 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 dcd998a096..21f255f2e6 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-2023 the original author or authors. + * Copyright 2015-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. 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 1fea6ba25b..728cab6d19 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-2023 the original author or authors. + * Copyright 2015-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. 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 ef8355c1f1..c05d61f12c 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-2023 the original author or authors. + * Copyright 2016-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. 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 59ea520325..7b6a7b1e71 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-2023 the original author or authors. + * Copyright 2016-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. 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 8838ebae80..fe82d0327e 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-2023 the original author or authors. + * Copyright 2018-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. 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 247fd3fec2..c8eab2d3a4 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-2023 the original author or authors. + * Copyright 2015-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. 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 new file mode 100644 index 0000000000..8ba04ac02e --- /dev/null +++ b/src/main/java/org/springframework/data/redis/repository/query/RedisPartTreeQuery.java @@ -0,0 +1,151 @@ +/* + * Copyright 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.repository.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.data.convert.DtoInstantiatingConverter; +import org.springframework.data.keyvalue.core.KeyValueOperations; +import org.springframework.data.keyvalue.core.query.KeyValueQuery; +import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; +import org.springframework.data.mapping.PersistentEntity; +import org.springframework.data.mapping.PersistentProperty; +import org.springframework.data.mapping.context.MappingContext; +import org.springframework.data.mapping.model.EntityInstantiators; +import org.springframework.data.redis.core.RedisKeyValueAdapter; +import org.springframework.data.redis.core.convert.RedisConverter; +import org.springframework.data.repository.query.ParameterAccessor; +import org.springframework.data.repository.query.ParametersParameterAccessor; +import org.springframework.data.repository.query.QueryMethod; +import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider; +import org.springframework.data.repository.query.ResultProcessor; +import org.springframework.data.repository.query.ReturnedType; +import org.springframework.data.repository.query.parser.AbstractQueryCreator; +import org.springframework.data.util.ReflectionUtils; +import org.springframework.data.util.Streamable; +import org.springframework.util.Assert; +import org.springframework.util.ClassUtils; + +/** + * Redis-specific implementation of {@link KeyValuePartTreeQuery} supporting projections. + * + * @author Mark Paluch + * @since 3.2.4 + */ +public class RedisPartTreeQuery extends KeyValuePartTreeQuery { + + private final RedisKeyValueAdapter adapter; + + public RedisPartTreeQuery(QueryMethod queryMethod, QueryMethodEvaluationContextProvider evaluationContextProvider, + KeyValueOperations template, Class> queryCreator) { + super(queryMethod, evaluationContextProvider, template, queryCreator); + this.adapter = (RedisKeyValueAdapter) template.getKeyValueAdapter(); + } + + @Override + public Object execute(Object[] parameters) { + + ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters); + KeyValueQuery query = prepareQuery(parameters); + ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); + + RedisConverter converter = adapter.getConverter(); + Converter resultPostProcessor = new ResultProcessingConverter(processor, + converter.getMappingContext(), converter.getEntityInstantiators()); + + Object source = doExecute(parameters, query); + return source != null ? processor.processResult(resultPostProcessor.convert(source)) : null; + } + + /** + * A {@link Converter} to post-process all source objects using the given {@link ResultProcessor}. + * + * @author Mark Paluch + */ + static final class ResultProcessingConverter implements Converter { + + private final ResultProcessor processor; + private final MappingContext, ? extends PersistentProperty> context; + private final EntityInstantiators instantiators; + + public ResultProcessingConverter(ResultProcessor processor, + MappingContext, ? extends PersistentProperty> context, + EntityInstantiators instantiators) { + + Assert.notNull(processor, "Processor must not be null!"); + Assert.notNull(context, "MappingContext must not be null!"); + Assert.notNull(instantiators, "Instantiators must not be null!"); + + this.processor = processor; + this.context = context; + this.instantiators = instantiators; + } + + /* + * (non-Javadoc) + * @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object) + */ + @Override + public Object convert(Object source) { + + if (source instanceof Set s) { + + Set target = new LinkedHashSet<>(s.size()); + + for (Object o : s) { + target.add(convert(o)); + } + + return target; + } + + if (source instanceof Collection c) { + + List target = new ArrayList<>(c.size()); + + for (Object o : c) { + target.add(convert(o)); + } + + return target; + } + + if (source instanceof Streamable s) { + return s.map(this::convert); + } + + ReturnedType returnedType = processor.getReturnedType(); + + if (ReflectionUtils.isVoid(returnedType.getReturnedType())) { + return null; + } + + if (ClassUtils.isPrimitiveOrWrapper(returnedType.getReturnedType())) { + return source; + } + + Converter converter = new DtoInstantiatingConverter(returnedType.getReturnedType(), context, + instantiators); + + return processor.processResult(source, converter); + } + } +} 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 1b6afa8a43..bb5d7dae69 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-2023 the original author or authors. + * Copyright 2015-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. 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 ba6d2a474e..6a3a9584d2 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-2023 the original author or authors. + * Copyright 2018-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. @@ -44,6 +44,7 @@ import org.springframework.data.redis.repository.query.RedisOperationChain; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.FluentQuery; +import org.springframework.data.repository.query.ListQueryByExampleExecutor; import org.springframework.data.repository.query.QueryByExampleExecutor; import org.springframework.data.support.PageableExecutionUtils; import org.springframework.data.util.Streamable; @@ -62,7 +63,7 @@ */ @SuppressWarnings("unchecked") public class QueryByExampleRedisExecutor - implements QueryByExampleExecutor, BeanFactoryAware, BeanClassLoaderAware { + implements ListQueryByExampleExecutor, BeanFactoryAware, BeanClassLoaderAware { private final EntityInformation entityInformation; private final RedisKeyValueTemplate keyValueTemplate; @@ -147,15 +148,17 @@ private Iterator doFind(Example example) { } @Override - public Iterable findAll(Example example) { + public List findAll(Example example) { RedisOperationChain operationChain = createQuery(example); - return (Iterable) keyValueTemplate.find(new KeyValueQuery<>(operationChain), entityInformation.getJavaType()); + Iterable result = keyValueTemplate.find(new KeyValueQuery<>(operationChain), entityInformation.getJavaType()); + + return (List) (result instanceof List list ? list : Streamable.of(result).toList()); } @Override - public Iterable findAll(Example example, Sort sort) { + public List findAll(Example example, Sort sort) { throw new UnsupportedOperationException("Ordering is not supported"); } 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 2ce06cbd3d..5197d7665c 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-2023 the original author or authors. + * Copyright 2015-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. @@ -16,11 +16,11 @@ package org.springframework.data.redis.repository.support; import org.springframework.data.keyvalue.core.KeyValueOperations; -import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.redis.core.mapping.RedisMappingContext; import org.springframework.data.redis.core.mapping.RedisPersistentEntity; import org.springframework.data.redis.repository.core.MappingRedisEntityInformation; +import org.springframework.data.redis.repository.query.RedisPartTreeQuery; import org.springframework.data.redis.repository.query.RedisQueryCreator; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.core.RepositoryMetadata; @@ -59,7 +59,7 @@ public RedisRepositoryFactory(KeyValueOperations keyValueOperations) { */ public RedisRepositoryFactory(KeyValueOperations keyValueOperations, Class> queryCreator) { - this(keyValueOperations, queryCreator, KeyValuePartTreeQuery.class); + this(keyValueOperations, queryCreator, RedisPartTreeQuery.class); } /** 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 b5adfd4df1..b0ecb53970 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-2023 the original author or authors. + * Copyright 2015-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. @@ -18,6 +18,7 @@ import org.springframework.beans.factory.FactoryBean; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean; +import org.springframework.data.redis.repository.query.RedisPartTreeQuery; import org.springframework.data.repository.Repository; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; @@ -44,6 +45,7 @@ public class RedisRepositoryFactoryBean, S, ID> */ public RedisRepositoryFactoryBean(Class repositoryInterface) { super(repositoryInterface); + setQueryType(RedisPartTreeQuery.class); } @Override 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 d8f9a4a7e6..57a2cb9e57 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-2023 the original author or authors. + * Copyright 2018-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. 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 972360985d..0be8d02331 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-2023 the original author or authors. + * 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. 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 4d4cb3b707..43fa91fa2d 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-2023 the original author or authors. + * 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. 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 75648685be..8232b17db8 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-2023 the original author or authors. + * 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. 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 eff6821fbd..2e4527d503 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-2023 the original author or authors. + * 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. 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 a85ddd17f9..28b9474b26 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-2023 the original author or authors. + * Copyright 2015-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. 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 67e88fe564..1071f6ee52 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-2023 the original author or authors. + * Copyright 2011-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. 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 85eac9da7f..76238bc60d 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-2023 the original author or authors. + * Copyright 2011-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. 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 c069dc6135..4e76cd4ba7 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-2023 the original author or authors. + * Copyright 2022-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. 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 eaa64d3e5f..b7383697f7 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-2023 the original author or authors. + * Copyright 2022-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. 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 77da2a1cb2..00c79c6f8a 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-2023 the original author or authors. + * Copyright 2011-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. 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 8d9fbb5d52..fb1eb4da5e 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-2023 the original author or authors. + * Copyright 2011-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. 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 db6064dd3c..445bebf45a 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-2023 the original author or authors. + * 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. 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 31b09b0001..fe30afbe50 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-2023 the original author or authors. + * 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. 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 23f54b5c35..f3157b3407 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-2023 the original author or authors. + * 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. 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 6da9eafa19..648a69dcd7 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-2023 the original author or authors. + * Copyright 2011-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. 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 fba498abc2..03ca10377d 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-2023 the original author or authors. + * 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. 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 a0fa613d5b..3f03667ff1 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-2023 the original author or authors. + * Copyright 2011-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. 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 2f10b400ad..bd2de9dffc 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-2023 the original author or authors. + * Copyright 2011-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. 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 c0b1f088d4..8af0002f46 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-2023 the original author or authors. + * Copyright 2011-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. 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 51973a561f..b7e3cd6369 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-2023 the original author or authors. + * Copyright 2018-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. 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 3520367261..25cd0d4b13 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-2023 the original author or authors. + * Copyright 2018-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. 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 19b3a10d3f..02af99b523 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-2023 the original author or authors. + * Copyright 2018-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. 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 d13b435522..45cb9e8cac 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-2023 the original author or authors. + * Copyright 2018-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. 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 2de179ec96..0c370c47a9 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-2023 the original author or authors. + * Copyright 2018-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. 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 14a66cf5e3..ff06716ac6 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-2023 the original author or authors. + * Copyright 2018-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. 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 2241246a28..6641a791c3 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-2023 the original author or authors. + * Copyright 2018-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. 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 e7114444e8..3bb2f22af2 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-2023 the original author or authors. + * Copyright 2018-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. 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 0306b28324..d10005c25d 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-2023 the original author or authors. + * Copyright 2018-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. 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 15e3ab34d9..97cf04117a 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-2023 the original author or authors. + * Copyright 2018-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. 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 12085ae173..b361fb7714 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-2023 the original author or authors. + * Copyright 2018-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. 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 19a0c7dd58..3cef647aa9 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-2023 the original author or authors. + * Copyright 2013-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. 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 fc22a8b5c5..dc4289f1d2 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-2023 the original author or authors. + * Copyright 2011-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. 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 d2a7178b70..9e92b0d873 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-2023 the original author or authors. + * Copyright 2011-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. 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 5baefb58d8..d8a2af95a9 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-2023 the original author or authors. + * Copyright 2011-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. 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 1daa03170d..e5b901a022 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-2023 the original author or authors. + * Copyright 2011-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. 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 03b7b405f8..fd2da300cf 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-2023 the original author or authors. + * Copyright 2011-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. 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 84fc18a961..d5cb4659ed 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-2023 the original author or authors. + * Copyright 2011-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. 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 208b6554c6..a1370d97a4 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-2023 the original author or authors. + * Copyright 2011-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. 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 6afcafa0de..d6ea8ee0a5 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-2023 the original author or authors. + * Copyright 2011-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. 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 427d6aa669..5bcf57199e 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-2023 the original author or authors. + * Copyright 2011-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. 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 d97a63dc50..a8e6228e41 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-2023 the original author or authors. + * Copyright 2011-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. 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 fa73762ce7..afa0624606 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-2023 the original author or authors. + * Copyright 2011-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. 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 7a70db36fd..a55f1f7a03 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-2023 the original author or authors. + * Copyright 2011-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. 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 bba099dc3f..650114cf1d 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-2023 the original author or authors. + * Copyright 2011-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. 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 c497db7212..61644f9787 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-2023 the original author or authors. + * Copyright 2011-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. 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 e68c0c7fec..60f0b0c3d1 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-2023 the original author or authors. + * Copyright 2011-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. 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 c7f231e49a..b931b3f014 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-2023 the original author or authors. + * Copyright 2011-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. 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 a9c24e8eb2..a0a8f5657d 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-2023 the original author or authors. + * Copyright 2011-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. 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 e71716cbcc..8451a80dde 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 the original author or authors. + * Copyright 2023-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. 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 f6ad110bee..93e4e76969 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-2023 the original author or authors. + * Copyright 2015-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. 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 bc63a3b9b3..34e5bfede7 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-2023 the original author or authors. + * 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. 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 f88593c0a4..c36c8d7710 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-2023 the original author or authors. + * Copyright 2022-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. 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 5def3e3537..492af3d9a4 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-2023 the original author or authors. + * Copyright 2019-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. 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 d99fc768c8..fe26ed4d66 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-2023 the original author or authors. + * Copyright 2019-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. 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 b62417c929..ebbf651325 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-2023 the original author or authors. + * Copyright 2019-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. 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 f5bbc2408f..b58a93ebcd 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-2023 the original author or authors. + * Copyright 2019-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. 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 6ec4f5b6d3..0878ae0a8b 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-2023 the original author or authors. + * Copyright 2019-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. 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 be596780c1..bd1d4db2c4 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-2023 the original author or authors. + * Copyright 2019-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. 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 d4dbb97314..8bba7683c0 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-2023 the original author or authors. + * Copyright 2019-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. 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 48d4c4aee9..2bdda370d6 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-2023 the original author or authors. + * Copyright 2019-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. 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 15deaf77fc..dcacae65de 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-2023 the original author or authors. + * Copyright 2019-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. 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 36f543ffc4..de0ed8a657 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-2023 the original author or authors. + * Copyright 2022-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. diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index b45226b148..5b4c9ef0b7 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.2 GA (2023.1.0) +Spring Data Redis 3.3 RC1 (2024.0.0) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -47,6 +47,9 @@ 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 1314843f67..8628d84ca3 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/ByteBufferObjectFactory.java b/src/test/java/org/springframework/data/redis/ByteBufferObjectFactory.java index 571c582046..b3d5315d29 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-2023 the original author or authors. + * 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. diff --git a/src/test/java/org/springframework/data/redis/ConnectionFactoryTracker.java b/src/test/java/org/springframework/data/redis/ConnectionFactoryTracker.java index 946097bd28..d619e6021c 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.java b/src/test/java/org/springframework/data/redis/DoubleAsStringObjectFactory.java index 3e4344f946..99d5ddea98 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-2023 the original author or authors. + * Copyright 2013-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. diff --git a/src/test/java/org/springframework/data/redis/DoubleObjectFactory.java b/src/test/java/org/springframework/data/redis/DoubleObjectFactory.java index ff4200d834..2d2ab66c57 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-2023 the original author or authors. + * Copyright 2013-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. diff --git a/src/test/java/org/springframework/data/redis/LongAsStringObjectFactory.java b/src/test/java/org/springframework/data/redis/LongAsStringObjectFactory.java index 3b24c1e6e1..9ee9af93c8 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-2023 the original author or authors. + * Copyright 2013-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. diff --git a/src/test/java/org/springframework/data/redis/LongObjectFactory.java b/src/test/java/org/springframework/data/redis/LongObjectFactory.java index 943328378f..da538b0f6d 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-2023 the original author or authors. + * Copyright 2013-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. diff --git a/src/test/java/org/springframework/data/redis/ObjectFactory.java b/src/test/java/org/springframework/data/redis/ObjectFactory.java index b83fbca944..3438d57ffa 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/Person.java b/src/test/java/org/springframework/data/redis/Person.java index 4e3b8d4819..0201e14a59 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/PersonObjectFactory.java b/src/test/java/org/springframework/data/redis/PersonObjectFactory.java index 03e85cd8cf..d429823a4c 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/PrefixStringObjectFactory.java b/src/test/java/org/springframework/data/redis/PrefixStringObjectFactory.java index 2450043a8a..d4b4b34525 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-2023 the original author or authors. + * 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. diff --git a/src/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.java b/src/test/java/org/springframework/data/redis/PropertyEditorsIntegrationTests.java index 66c99f1f55..7eae9bdc85 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/RawObjectFactory.java b/src/test/java/org/springframework/data/redis/RawObjectFactory.java index a2ca782046..fd0148881f 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-2023 the original author or authors. + * Copyright 2013-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. diff --git a/src/test/java/org/springframework/data/redis/RedisViewPE.java b/src/test/java/org/springframework/data/redis/RedisViewPE.java index f3566f6fb5..d4b7e25853 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/SettingsUtils.java b/src/test/java/org/springframework/data/redis/SettingsUtils.java index 51ea95a486..cadeca6ff7 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/StringObjectFactory.java b/src/test/java/org/springframework/data/redis/StringObjectFactory.java index 770d825aef..609d9405e9 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-2023 the original author or authors. + * Copyright 2011-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. diff --git a/src/test/java/org/springframework/data/redis/TestCondition.java b/src/test/java/org/springframework/data/redis/TestCondition.java index a23a15d841..3eceff67d4 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-2023 the original author or authors. + * Copyright 2013-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. 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 cafdd6c5dd..538a059d33 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-2023 the original author or authors. + * 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. 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 14510786b3..bdef135de1 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-2023 the original author or authors. + * Copyright 2020-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. 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 7896b5837f..233333ef83 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-2023 the original author or authors. + * 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. 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 0ae1308c05..1f07ea6110 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-2023 the original author or authors. + * 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. @@ -21,14 +21,19 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; import org.junit.jupiter.api.BeforeEach; + import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisStringCommands.SetOption; @@ -38,12 +43,14 @@ import org.springframework.data.redis.test.condition.RedisDriver; import org.springframework.data.redis.test.extension.parametrized.MethodSource; import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest; +import org.springframework.lang.Nullable; /** * Integration tests for {@link DefaultRedisCacheWriter}. * * @author Christoph Strobl * @author Mark Paluch + * @author ChanYoung Joung */ @MethodSource("testParams") public class DefaultRedisCacheWriterTests { @@ -419,6 +426,75 @@ void noOpStatisticsCollectorReturnsEmptyStatsInstance() { assertThat(stats.getPuts()).isZero(); } + @ParameterizedRedisTest // GH-1686 + void doLockShouldGetLock() throws InterruptedException { + + int threadCount = 3; + CountDownLatch beforeWrite = new CountDownLatch(threadCount); + CountDownLatch afterWrite = new CountDownLatch(threadCount); + AtomicLong concurrency = new AtomicLong(); + + DefaultRedisCacheWriter cw = new DefaultRedisCacheWriter(connectionFactory, Duration.ofMillis(10), + BatchStrategies.keys()) { + + boolean doLock(String name, Object contextualKey, @Nullable Object contextualValue, RedisConnection connection) { + + boolean doLock = super.doLock(name, contextualKey, contextualValue, connection); + + // any concurrent access (aka not waiting until the lock is acquired) will result in a concurrency greater 1 + assertThat(concurrency.incrementAndGet()).isOne(); + return doLock; + } + + @Nullable + @Override + Long doUnlock(String name, RedisConnection connection) { + try { + return super.doUnlock(name, connection); + } finally { + concurrency.decrementAndGet(); + } + } + }; + + cw.lock(CACHE_NAME); + + // introduce concurrency + List> completions = new ArrayList<>(); + for (int i = 0; i < threadCount; i++) { + + CompletableFuture completion = new CompletableFuture<>(); + completions.add(completion); + + Thread th = new Thread(() -> { + beforeWrite.countDown(); + try { + cw.putIfAbsent(CACHE_NAME, binaryCacheKey, binaryCacheValue, Duration.ZERO); + completion.complete(null); + } catch (Throwable e) { + completion.completeExceptionally(e); + } + afterWrite.countDown(); + }); + + th.start(); + } + + assertThat(beforeWrite.await(5, TimeUnit.SECONDS)).isTrue(); + Thread.sleep(100); + + cw.unlock(CACHE_NAME); + assertThat(afterWrite.await(5, TimeUnit.SECONDS)).isTrue(); + + for (CompletableFuture completion : completions) { + assertThat(completion).isCompleted().isCompletedWithValue(null); + } + + doWithConnection(conn -> { + assertThat(conn.exists("default-redis-cache-writer-tests~lock".getBytes())).isFalse(); + }); + } + private void doWithConnection(Consumer callback) { try (RedisConnection connection = connectionFactory.getConnection()) { 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 cc616999f5..9ef7231ae7 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-2023 the original author or authors. + * Copyright 2011-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. 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 1b9be56d75..b80358ea9e 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-2023 the original author or authors. + * Copyright 2020-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. 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 62ac41b055..edbe99e964 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-2023 the original author or authors. + * Copyright 2018-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. 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 59d13ca6ef..699d07917d 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-2023 the original author or authors. + * 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. 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 ebf1b5d8a1..6677ab7a9d 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-2023 the original author or authors. + * 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. @@ -15,10 +15,8 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.awaitility.Awaitility.await; +import static org.assertj.core.api.Assertions.*; +import static org.awaitility.Awaitility.*; import io.netty.util.concurrent.DefaultThreadFactory; @@ -575,8 +573,7 @@ void cacheGetWithTimeToIdleExpirationAfterEntryExpiresShouldReturnNull() { void retrieveCacheValueUsingJedis() { assertThatExceptionOfType(UnsupportedOperationException.class) - .isThrownBy(() -> this.cache.retrieve(this.binaryCacheKey)) - .withMessageContaining("RedisCache"); + .isThrownBy(() -> this.cache.retrieve(this.binaryCacheKey)).withMessageContaining("RedisCache"); } @ParameterizedRedisTest // GH-2650 @@ -590,23 +587,51 @@ void retrieveLoadedValueUsingJedis() { @ParameterizedRedisTest // GH-2650 @EnabledOnRedisDriver(RedisDriver.LETTUCE) - @SuppressWarnings("unchecked") void retrieveReturnsCachedValue() throws Exception { doWithConnection(connection -> connection.stringCommands().set(this.binaryCacheKey, this.binarySample)); + RedisCache cache = new RedisCache("cache", usingLockingRedisCacheWriter(), + usingRedisCacheConfiguration().disableCachingNullValues()); + + CompletableFuture value = cache.retrieve(this.key); + + assertThat(value).isNotNull(); + assertThat(value.get(5, TimeUnit.SECONDS)).isNotNull(); + assertThat(value.get().get()).isEqualTo(this.sample); + assertThat(value).isDone(); + } + + @ParameterizedRedisTest // GH-2650 + @EnabledOnRedisDriver(RedisDriver.LETTUCE) + void retrieveReturnsCachedNullableValue() throws Exception { + + doWithConnection(connection -> connection.stringCommands().set(this.binaryCacheKey, this.binarySample)); + RedisCache cache = new RedisCache("cache", usingLockingRedisCacheWriter(), usingRedisCacheConfiguration()); - CompletableFuture value = (CompletableFuture) cache.retrieve(this.key); + CompletableFuture value = cache.retrieve(this.key); assertThat(value).isNotNull(); - assertThat(value.get()).isEqualTo(this.sample); + assertThat(value.get().get()).isEqualTo(this.sample); assertThat(value).isDone(); } + @ParameterizedRedisTest // GH-2783 + @EnabledOnRedisDriver(RedisDriver.LETTUCE) + void retrieveReturnsCachedNullValue() throws Exception { + + doWithConnection(connection -> connection.set(binaryCacheKey, binaryNullValue)); + + CompletableFuture value = (CompletableFuture) cache.retrieve(this.key); + ValueWrapper wrapper = value.get(5, TimeUnit.SECONDS); + + assertThat(wrapper).isNotNull(); + assertThat(wrapper.get()).isNull(); + } + @ParameterizedRedisTest // GH-2650 @EnabledOnRedisDriver(RedisDriver.LETTUCE) - @SuppressWarnings("unchecked") void retrieveReturnsCachedValueWhenLockIsReleased() throws Exception { String testValue = "TestValue"; @@ -622,13 +647,12 @@ void retrieveReturnsCachedValueWhenLockIsReleased() throws Exception { cacheWriter.lock("cache"); - CompletableFuture value = (CompletableFuture) cache.retrieve(this.key); - + CompletableFuture value = cache.retrieve(this.key); assertThat(value).isNotDone(); cacheWriter.unlock("cache"); - assertThat(value.get(15L, TimeUnit.MILLISECONDS)).isEqualTo(testValue); + assertThat(value.get(15L, TimeUnit.MILLISECONDS).get()).isEqualTo(testValue); assertThat(value).isDone(); } @@ -649,7 +673,6 @@ void retrieveReturnsLoadedValue() throws Exception { CompletableFuture value = cache.retrieve(this.key, valueLoaderSupplier); - assertThat(loaded.get()).isFalse(); assertThat(value.get()).isEqualTo(jon); assertThat(loaded.get()).isTrue(); assertThat(value).isDone(); @@ -666,8 +689,9 @@ void retrieveStoresLoadedValue() throws Exception { cache.retrieve(this.key, valueLoaderSupplier).get(); - doWithConnection(connection -> - assertThat(connection.keyCommands().exists("cache::key-1".getBytes(StandardCharsets.UTF_8))).isTrue()); + doWithConnection( + connection -> assertThat(connection.keyCommands().exists("cache::key-1".getBytes(StandardCharsets.UTF_8))) + .isTrue()); } @ParameterizedRedisTest // GH-2650 @@ -678,11 +702,18 @@ void retrieveReturnsNull() throws Exception { RedisCache cache = new RedisCache("cache", usingLockingRedisCacheWriter(), usingRedisCacheConfiguration()); - CompletableFuture value = cache.retrieve(this.key); + CompletableFuture value = cache.retrieve(this.key); assertThat(value).isNotNull(); - assertThat(value.get()).isNull(); + assertThat(value.get(5, TimeUnit.SECONDS).get()).isNull(); assertThat(value).isDone(); + + doWithConnection(connection -> connection.keyCommands().del(this.binaryCacheKey)); + + value = cache.retrieve(this.key); + + assertThat(value).isNotNull(); + assertThat(value.get(5, TimeUnit.SECONDS)).isNull(); } private CompletableFuture usingCompletedFuture(T value) { 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 45d1747d02..94fae0870f 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-2023 the original author or authors. + * 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. @@ -15,20 +15,14 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.concurrent.CompletableFuture; import org.junit.jupiter.api.Test; +import org.springframework.cache.Cache.ValueWrapper; import org.springframework.data.redis.serializer.RedisSerializationContext.SerializationPair; /** @@ -40,7 +34,6 @@ class RedisCacheUnitTests { @Test // GH-2650 - @SuppressWarnings("unchecked") void cacheRetrieveValueCallsCacheWriterRetrieveCorrectly() throws Exception { RedisCacheWriter mockCacheWriter = mock(RedisCacheWriter.class); @@ -53,10 +46,10 @@ void cacheRetrieveValueCallsCacheWriterRetrieveCorrectly() throws Exception { RedisCache cache = new RedisCache("TestCache", mockCacheWriter, cacheConfiguration); - CompletableFuture value = (CompletableFuture) cache.retrieve("TestKey"); + CompletableFuture value = cache.retrieve("TestKey"); assertThat(value).isNotNull(); - assertThat(new String(value.get())).isEqualTo("TEST"); + assertThat(new String((byte[]) value.get().get())).isEqualTo("TEST"); verify(mockCacheWriter, times(1)).retrieve(eq("TestCache"), isA(byte[].class)); verify(mockCacheWriter).supportsAsyncRetrieve(); @@ -64,6 +57,6 @@ void cacheRetrieveValueCallsCacheWriterRetrieveCorrectly() throws Exception { } private CompletableFuture usingCompletedFuture(T value) { - return CompletableFuture.completedFuture(value); + return CompletableFuture.completedFuture(value); } } 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 b3f01a06a0..e9d6ce75ff 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 the original author or authors. + * Copyright 2023-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. 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 3ffe5943f9..c02fe6be4b 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-2023 the original author or authors. + * Copyright 2011-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. @@ -17,10 +17,15 @@ import static org.assertj.core.api.Assertions.*; +import jakarta.annotation.Resource; + import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.StreamOperations; import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; diff --git a/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java b/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java new file mode 100644 index 0000000000..2c88f2a3b3 --- /dev/null +++ b/src/test/java/org/springframework/data/redis/config/PropertyEditorSupportIntegrationTests.java @@ -0,0 +1,63 @@ +/* + * Copyright 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.config; + +import static org.assertj.core.api.Assertions.*; + +import jakarta.annotation.Resource; + +import org.junit.jupiter.api.Test; + +import org.springframework.data.redis.core.ClusterOperations; +import org.springframework.data.redis.core.GeoOperations; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.HyperLogLogOperations; +import org.springframework.data.redis.core.SetOperations; +import org.springframework.data.redis.core.StreamOperations; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.data.redis.core.ZSetOperations; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +/** + * Integration tests to obtain various template resources through {@code @Resource} injection. + * + * @author Mark Paluch + */ +@SpringJUnitConfig(locations = "namespace.xml") +class PropertyEditorSupportIntegrationTests { + + @Resource(name = "redisTemplate") ClusterOperations cluster; + @Resource(name = "redisTemplate") GeoOperations geo; + @Resource(name = "redisTemplate") HashOperations hash; + @Resource(name = "redisTemplate") HyperLogLogOperations hll; + @Resource(name = "redisTemplate") SetOperations set; + @Resource(name = "redisTemplate") StreamOperations stream; + @Resource(name = "redisTemplate") ValueOperations value; + @Resource(name = "redisTemplate") ZSetOperations zSet; + + @Test // GH-2828, GH-2825 + void shouldInjectResources() { + + assertThat(cluster).isNotNull(); + assertThat(geo).isNotNull(); + assertThat(hash).isNotNull(); + assertThat(hll).isNotNull(); + assertThat(set).isNotNull(); + assertThat(stream).isNotNull(); + assertThat(value).isNotNull(); + assertThat(zSet).isNotNull(); + } +} 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 6193e65aa3..2c43190c89 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-2023 the original author or authors. + * Copyright 2011-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. 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 f5b0d4bf41..1d96b83a2f 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-2023 the original author or authors. + * Copyright 2011-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. @@ -28,6 +28,7 @@ import static org.springframework.data.redis.connection.RedisGeoCommands.GeoSearchStoreCommandArgs.*; import static org.springframework.data.redis.core.ScanOptions.*; +import java.nio.charset.StandardCharsets; import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -35,6 +36,7 @@ import java.util.concurrent.BlockingDeque; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; import org.assertj.core.data.Offset; import org.junit.AssumptionViolatedException; @@ -2661,10 +2663,11 @@ private static List toList(Cursor cursor) { } @Test // DATAREDIS-417 - @DisabledOnOs(value = MAC, architectures = "aarch64") - public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() { + public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() { - connection.execute("DEBUG", "POPULATE".getBytes(), "100".getBytes()); + byteConnection.openPipeline(); + IntStream.range(0, 100).forEach(it -> byteConnection.stringCommands().set("key:%s".formatted(it).getBytes(StandardCharsets.UTF_8), "data".getBytes(StandardCharsets.UTF_8))); + byteConnection.closePipeline(); Cursor cursor = connection.scan(ScanOptions.scanOptions().match("key*9").count(10).build()); 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 3b4927fea6..f30dc5f108 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-2023 the original author or authors. + * Copyright 2011-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. @@ -149,8 +149,8 @@ public void testClosePipelineNotOpen() { @Test // DATAREDIS-417 @Disabled @Override - public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() { - super.scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection(); + public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() { + super.scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection(); } @Override 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 20fdc3daaa..1b5c4672f5 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-2023 the original author or authors. + * Copyright 2013-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. @@ -144,8 +144,8 @@ public void testScriptKill() { @Test // DATAREDIS-417 @Disabled @Override - public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() { - super.scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection(); + public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() { + super.scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection(); } @Override 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 20ab8a201b..050ffaee56 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-2023 the original author or authors. + * Copyright 2014-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. 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 3059eeeb6e..1c63fbdd3e 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-2023 the original author or authors. + * Copyright 2014-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. @@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.test.annotation.Rollback; @@ -132,6 +133,18 @@ public void valueOperationSetShouldBeCommittedCorrectly() { } } + @Rollback(false) + @Test // GH-2886 + public void shouldReturnReadOnlyCommandResultInTransaction() { + + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + template.setEnableTransactionSupport(true); + template.afterPropertiesSet(); + + assertThat(template.hasKey("foo")).isFalse(); + } + @Test // DATAREDIS-548 @Transactional(readOnly = true) public void valueOperationShouldWorkWithReadOnlyTransactions() { 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 5f4e517004..693ef624bc 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-2023 the original author or authors. + * Copyright 2019-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. 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 29b01ddc97..b3a6d5f33e 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-2023 the original author or authors. + * Copyright 2015-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. 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 3a99115e8e..2d13df6131 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-2023 the original author or authors. + * Copyright 2015-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. 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 2fd5d55886..f48d44ce8d 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-2023 the original author or authors. + * Copyright 2015-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. 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 9dbb611392..cb33e10de2 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-2023 the original author or authors. + * Copyright 2015-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. @@ -25,6 +25,7 @@ public abstract class ClusterTestVariables { public static final String KEY_1 = "key1"; public static final String KEY_2 = "key2"; public static final String KEY_3 = "key3"; + public static final String KEY_4 = "key4"; public static final String VALUE_1 = "value1"; public static final String VALUE_2 = "value2"; 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 21643926ca..74ad0677e9 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-2023 the original author or authors. + * Copyright 2013-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. 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 0c655cdde1..3f9f4a0cbb 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-2023 the original author or authors. + * Copyright 2013-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. 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 4495aaa2ce..9931ac330d 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-2023 the original author or authors. + * Copyright 2013-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. 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 24a221e7fe..5f7db6e388 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-2023 the original author or authors. + * Copyright 2013-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. 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 e81cd8ae4d..6d969d0876 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-2023 the original author or authors. + * Copyright 2015-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. @@ -83,8 +83,7 @@ void shouldThrowExecptionOnInvalidHostAndPortString() { @Test // DATAREDIS-315 void shouldThrowExceptionWhenListOfHostAndPortIsNull() { - assertThatIllegalArgumentException() - .isThrownBy(() -> new RedisClusterConfiguration(Collections.singleton(null))); + assertThatIllegalArgumentException().isThrownBy(() -> new RedisClusterConfiguration(Collections.singleton(null))); } @Test // DATAREDIS-315 @@ -97,13 +96,13 @@ void shouldNotFailWhenListOfHostAndPortIsEmpty() { @Test // DATAREDIS-315 void shouldThrowExceptionGivenNullPropertySource() { - assertThatIllegalArgumentException().isThrownBy(() -> new RedisClusterConfiguration((PropertySource) null)); + assertThatIllegalArgumentException().isThrownBy(() -> RedisClusterConfiguration.of((PropertySource) null)); } @Test // DATAREDIS-315 void shouldNotFailWhenGivenPropertySourceNotContainingRelevantProperties() { - RedisClusterConfiguration config = new RedisClusterConfiguration(new MockPropertySource()); + RedisClusterConfiguration config = RedisClusterConfiguration.of(new MockPropertySource()); assertThat(config.getMaxRedirects()).isNull(); assertThat(config.getClusterNodes().size()).isEqualTo(0); @@ -116,7 +115,7 @@ void shouldBeCreatedCorrectlyGivenValidPropertySourceWithSingleHostPort() { propertySource.setProperty("spring.redis.cluster.nodes", HOST_AND_PORT_1); propertySource.setProperty("spring.redis.cluster.max-redirects", "5"); - RedisClusterConfiguration config = new RedisClusterConfiguration(propertySource); + RedisClusterConfiguration config = RedisClusterConfiguration.of(propertySource); assertThat(config.getMaxRedirects()).isEqualTo(5); assertThat(config.getClusterNodes()).contains(new RedisNode("127.0.0.1", 123)); @@ -130,7 +129,7 @@ void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMultipleHostPort() { StringUtils.collectionToCommaDelimitedString(Arrays.asList(HOST_AND_PORT_1, HOST_AND_PORT_2, HOST_AND_PORT_3))); propertySource.setProperty("spring.redis.cluster.max-redirects", "5"); - RedisClusterConfiguration config = new RedisClusterConfiguration(propertySource); + RedisClusterConfiguration config = RedisClusterConfiguration.of(propertySource); assertThat(config.getMaxRedirects()).isEqualTo(5); assertThat(config.getClusterNodes()).contains(new RedisNode("127.0.0.1", 123), new RedisNode("localhost", 456), @@ -138,7 +137,7 @@ void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMultipleHostPort() { } @Test // GH-2360 - public void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMultipleIPv6AddressesAndPorts() { + void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMultipleIPv6AddressesAndPorts() { MockPropertySource propertySource = new MockPropertySource(); @@ -146,7 +145,7 @@ public void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMultipleIPv6Addr StringUtils.collectionToCommaDelimitedString(Arrays.asList(HOST_AND_PORT_4, HOST_AND_PORT_5))); propertySource.setProperty("spring.redis.cluster.max-redirects", 2); - RedisClusterConfiguration configuration = new RedisClusterConfiguration(propertySource); + RedisClusterConfiguration configuration = RedisClusterConfiguration.of(propertySource); assertThat(configuration.getMaxRedirects()).isEqualTo(2); assertThat(configuration.getClusterNodes()).contains(new RedisNode("fe80::a00:27ff:fe4b:ee48", 6379), 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 85a603e4ca..0345e8bfb5 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-2023 the original author or authors. + * 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. 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 b1426bf1ff..2a10866752 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-2023 the original author or authors. + * Copyright 2014-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. 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 16c7443f18..d0940d99c6 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-2023 the original author or authors. + * Copyright 2018-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. 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 3ef4e00c0c..ac5c87748f 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-2023 the original author or authors. + * 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. 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 f43af2d5d8..2b38c0a751 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-2023 the original author or authors. + * Copyright 2015-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. @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashSet; +import org.assertj.core.api.ThrowableAssert; import org.junit.jupiter.api.Test; import org.springframework.mock.env.MockPropertySource; @@ -32,6 +33,8 @@ * @author Christoph Strobl * @author Mark Paluch * @author Vikas Garg + * @author Samuel Klose + * @author Mustapha Zorgati */ class RedisSentinelConfigurationUnitTests { @@ -93,13 +96,13 @@ void shouldNotFailWhenListOfHostAndPortIsEmpty() { @Test // DATAREDIS-372 void shouldThrowExceptionGivenNullPropertySource() { - assertThatIllegalArgumentException().isThrownBy(() -> new RedisSentinelConfiguration(null)); + assertThatIllegalArgumentException().isThrownBy(() -> RedisSentinelConfiguration.of(null)); } @Test // DATAREDIS-372 void shouldNotFailWhenGivenPropertySourceNotContainingRelevantProperties() { - RedisSentinelConfiguration config = new RedisSentinelConfiguration(new MockPropertySource()); + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(new MockPropertySource()); assertThat(config.getMaster()).isNull(); assertThat(config.getSentinels()).isEmpty(); @@ -112,7 +115,7 @@ void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMasterAndSingleHostPort propertySource.setProperty("spring.redis.sentinel.master", "myMaster"); propertySource.setProperty("spring.redis.sentinel.nodes", HOST_AND_PORT_1); - RedisSentinelConfiguration config = new RedisSentinelConfiguration(propertySource); + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); assertThat(config.getMaster()).isNotNull(); assertThat(config.getMaster().getName()).isEqualTo("myMaster"); @@ -128,7 +131,7 @@ void shouldBeCreatedCorrectlyGivenValidPropertySourceWithMasterAndMultipleHostPo propertySource.setProperty("spring.redis.sentinel.nodes", StringUtils.collectionToCommaDelimitedString(Arrays.asList(HOST_AND_PORT_1, HOST_AND_PORT_2, HOST_AND_PORT_3))); - RedisSentinelConfiguration config = new RedisSentinelConfiguration(propertySource); + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); assertThat(config.getSentinels()).hasSize(3); assertThat(config.getSentinels()).contains(new RedisNode("127.0.0.1", 123), new RedisNode("localhost", 456), @@ -148,6 +151,7 @@ void dataNodePasswordDoesNotAffectSentinelPassword() { @Test // GH-2218 void dataNodeUsernameDoesNotAffectSentinelUsername() { + RedisSentinelConfiguration configuration = new RedisSentinelConfiguration("myMaster", Collections.singleton(HOST_AND_PORT_1)); configuration.setUsername("data-admin"); @@ -165,7 +169,7 @@ void readSentinelPasswordFromConfigProperty() { propertySource.setProperty("spring.redis.sentinel.nodes", HOST_AND_PORT_1); propertySource.setProperty("spring.redis.sentinel.password", "computer-says-no"); - RedisSentinelConfiguration config = new RedisSentinelConfiguration(propertySource); + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); assertThat(config.getSentinelPassword()).isEqualTo(RedisPassword.of("computer-says-no")); assertThat(config.getSentinels()).hasSize(1).contains(new RedisNode("127.0.0.1", 123)); @@ -180,10 +184,67 @@ void readSentinelUsernameFromConfigProperty() { propertySource.setProperty("spring.redis.sentinel.username", "sentinel-admin"); propertySource.setProperty("spring.redis.sentinel.password", "foo"); - RedisSentinelConfiguration config = new RedisSentinelConfiguration(propertySource); + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); assertThat(config.getSentinelUsername()).isEqualTo("sentinel-admin"); assertThat(config.getSentinelPassword()).isEqualTo(RedisPassword.of("foo")); assertThat(config.getSentinels()).hasSize(1).contains(new RedisNode("127.0.0.1", 123)); } + + @Test // GH-2860 + void readSentinelDataNodeUsernameFromConfigProperty() { + + MockPropertySource propertySource = new MockPropertySource(); + propertySource.setProperty("spring.redis.sentinel.dataNode.username", "datanode-user"); + + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); + + assertThat(config.getDataNodeUsername()).isEqualTo("datanode-user"); + } + + @Test // GH-2860 + void readSentinelDataNodePasswordFromConfigProperty() { + + MockPropertySource propertySource = new MockPropertySource(); + propertySource.setProperty("spring.redis.sentinel.dataNode.password", "datanode-password"); + + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); + + assertThat(config.getDataNodePassword()).isEqualTo(RedisPassword.of("datanode-password")); + } + + @Test // GH-2860 + void readSentinelDataNodeDatabaseFromConfigProperty() { + + MockPropertySource propertySource = new MockPropertySource(); + propertySource.setProperty("spring.redis.sentinel.dataNode.database", "5"); + + RedisSentinelConfiguration config = RedisSentinelConfiguration.of(propertySource); + + assertThat(config.getDatabase()).isEqualTo(5); + } + + @Test // GH-2860 + void shouldThrowErrorWhen() { + + MockPropertySource propertySource = new MockPropertySource(); + propertySource.setProperty("spring.redis.sentinel.dataNode.database", "thisIsNotAnInteger"); + + ThrowableAssert.ThrowingCallable call = () -> RedisSentinelConfiguration.of(propertySource); + + assertThatThrownBy(call).isInstanceOf(IllegalArgumentException.class) + .hasMessage("Invalid DB index '%s'; integer required", "thisIsNotAnInteger"); + } + + @Test // GH-2860 + void shouldThrowErrorWhen2() { + + MockPropertySource propertySource = new MockPropertySource(); + propertySource.setProperty("spring.redis.sentinel.dataNode.database", "null"); + + ThrowableAssert.ThrowingCallable call = () -> RedisSentinelConfiguration.of(propertySource); + + assertThatThrownBy(call).isInstanceOf(IllegalArgumentException.class) + .hasMessage("Invalid DB index '%s'; integer required", "null"); + } } 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 ca2e19fe16..215f56f374 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-2023 the original author or authors. + * 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. 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 9c7913a9b8..28774e5156 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 the original author or authors. + * Copyright 2023-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. 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 29e5db453f..4c51047f9a 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-2023 the original author or authors. + * Copyright 2020-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. 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 eb43f4a5e1..d1073dc31b 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-2023 the original author or authors. + * Copyright 2018-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. 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 de7ff4d791..beabaad473 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-2023 the original author or authors. + * Copyright 2018-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. 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 a6aa3758f0..74d3f7df8d 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-2023 the original author or authors. + * Copyright 2016-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. 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 0fd16e36e5..38dd34c0b2 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-2023 the original author or authors. + * Copyright 2020-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. 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 0b74929770..ccb41b5ff9 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-2023 the original author or authors. + * 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. 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 9e82e74bf4..0ebc8ea86d 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-2023 the original author or authors. + * Copyright 2015-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. 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 200b01e951..7a341018a7 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-2023 the original author or authors. + * 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. 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 f9a8d7b4a0..1a3a3d6bd1 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-2023 the original author or authors. + * Copyright 2014-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. 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 71ee1ab239..f6e3f3f9e4 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-2023 the original author or authors. + * Copyright 2014-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. @@ -35,6 +35,7 @@ import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.junit.jupiter.api.Test; + import org.springframework.data.redis.connection.RedisClusterConfiguration; import org.springframework.data.redis.connection.RedisPassword; import org.springframework.data.redis.connection.RedisSentinelConfiguration; @@ -337,6 +338,21 @@ void afterPropertiesTriggersConnectionInitialization() { assertThat(connectionFactory.isRunning()).isTrue(); } + @Test // GH-2866 + void earlyStartupDoesNotStartConnectionFactory() { + + JedisConnectionFactory connectionFactory = new JedisConnectionFactory(new JedisPoolConfig()); + + connectionFactory.setEarlyStartup(false); + connectionFactory.afterPropertiesSet(); + + assertThat(connectionFactory.isEarlyStartup()).isFalse(); + assertThat(connectionFactory.isAutoStartup()).isTrue(); + assertThat(connectionFactory.isRunning()).isFalse(); + + assertThat(ReflectionTestUtils.getField(connectionFactory, "pool")).isNull(); + } + private JedisConnectionFactory initSpyedConnectionFactory(RedisSentinelConfiguration sentinelConfiguration, @Nullable JedisPoolConfig poolConfig) { 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 1c2a237f32..21446b5644 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-2023 the original author or authors. + * Copyright 2011-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. 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 1250aafd87..a5cacfb2df 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-2023 the original author or authors. + * Copyright 2011-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. 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 4e287e1c9e..45706608a2 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-2023 the original author or authors. + * Copyright 2011-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. 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 920a6e6512..4a9150d4de 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-2023 the original author or authors. + * Copyright 2014-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. @@ -27,19 +27,22 @@ import java.io.IOException; import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; 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.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.dao.InvalidDataAccessResourceUsageException; import org.springframework.data.redis.connection.AbstractConnectionUnitTestBase; import org.springframework.data.redis.connection.RedisServerCommands.ShutdownOption; import org.springframework.data.redis.connection.zset.Tuple; import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.KeyScanOptions; import org.springframework.data.redis.core.ScanOptions; /** @@ -179,6 +182,23 @@ public void scanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException verify(jedisSpy, times(1)).disconnect(); } + @Test // GH-2796 + void scanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); + doReturn(new ScanResult<>(cursorId, List.of("spring".getBytes()))).when(jedisSpy).scan(any(byte[].class), + any(ScanParams.class)); + + Cursor cursor = connection.scan(KeyScanOptions.NONE); + cursor.next(); // initial value + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + verify(jedisSpy, times(2)).scan(captor.capture(), any(ScanParams.class)); + assertThat(captor.getAllValues()).map(String::new).containsExactly("0", cursorId); + } + @Test // DATAREDIS-531 public void sScanShouldKeepTheConnectionOpen() { @@ -202,6 +222,23 @@ public void sScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException verify(jedisSpy, times(1)).disconnect(); } + @Test // GH-2796 + void sScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); + doReturn(new ScanResult<>(cursorId, List.of("spring".getBytes()))).when(jedisSpy).sscan(any(byte[].class), + any(byte[].class), any(ScanParams.class)); + + Cursor cursor = connection.setCommands().sScan("spring".getBytes(), ScanOptions.NONE); + cursor.next(); // initial value + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + verify(jedisSpy, times(2)).sscan(any(byte[].class), captor.capture(), any(ScanParams.class)); + assertThat(captor.getAllValues()).map(String::new).containsExactly("0", cursorId); + } + @Test // DATAREDIS-531 public void zScanShouldKeepTheConnectionOpen() { @@ -225,6 +262,23 @@ public void zScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException verify(jedisSpy, times(1)).disconnect(); } + @Test // GH-2796 + void zScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); + doReturn(new ScanResult<>(cursorId, List.of(new redis.clients.jedis.resps.Tuple("spring", 1D)))).when(jedisSpy).zscan(any(byte[].class), + any(byte[].class), any(ScanParams.class)); + + Cursor cursor = connection.zSetCommands().zScan("spring".getBytes(), ScanOptions.NONE); + cursor.next(); // initial value + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + verify(jedisSpy, times(2)).zscan(any(byte[].class), captor.capture(), any(ScanParams.class)); + assertThat(captor.getAllValues()).map(String::new).containsExactly("0", cursorId); + } + @Test // DATAREDIS-531 public void hScanShouldKeepTheConnectionOpen() { @@ -248,6 +302,23 @@ public void hScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException verify(jedisSpy, times(1)).disconnect(); } + @Test // GH-2796 + void hScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); + doReturn(new ScanResult<>(cursorId, List.of(Map.entry("spring".getBytes(), "data".getBytes())))).when(jedisSpy).hscan(any(byte[].class), + any(byte[].class), any(ScanParams.class)); + + Cursor> cursor = connection.hashCommands().hScan("spring".getBytes(), ScanOptions.NONE); + cursor.next(); // initial value + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + verify(jedisSpy, times(2)).hscan(any(byte[].class), captor.capture(), any(ScanParams.class)); + assertThat(captor.getAllValues()).map(String::new).containsExactly("0", cursorId); + } + @Test // DATAREDIS-714 void doesNotSelectDbWhenCurrentDbMatchesDesiredOne() { @@ -369,6 +440,29 @@ public void hScanShouldCloseTheConnectionWhenCursorIsClosed() { .isThrownBy(() -> super.hScanShouldCloseTheConnectionWhenCursorIsClosed()); } + @Test + @Disabled("scan not supported in pipeline") + void scanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void sScanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void zScanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void hScanShouldOperateUponUnsigned64BitCursorId() { + + } } } 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 7cbc1b6e92..21c1b8e41d 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-2023 the original author or authors. + * Copyright 2014-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. 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 5057c02bd7..b83593891b 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-2023 the original author or authors. + * Copyright 2015-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. 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 90592f0f9c..e7ec289152 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-2023 the original author or authors. + * Copyright 2014-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. 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 5cbcc562ae..cd036204ae 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-2023 the original author or authors. + * Copyright 2014-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. 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 8ad410188b..262c185d59 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-2023 the original author or authors. + * Copyright 2011-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. 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 5a78dd1149..fb4e4057fe 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-2023 the original author or authors. + * Copyright 2015-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. 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 e13715b875..269cf395a5 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-2023 the original author or authors. + * Copyright 2016-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. 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 6925084a4a..e5c79be848 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-2023 the original author or authors. + * Copyright 2014-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. 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 d1517f404a..07b59cd38a 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-2023 the original author or authors. + * Copyright 2020-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. 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 be92112ea6..f16a64f6e5 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-2023 the original author or authors. + * Copyright 2020-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. 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 c5e7056c0e..35c818bb81 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-2023 the original author or authors. + * 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. 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 4b6b50d3e3..5ecba15478 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-2023 the original author or authors. + * Copyright 2015-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. @@ -83,6 +83,7 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests { private static final byte[] KEY_1_BYTES = LettuceConverters.toBytes(KEY_1); private static final byte[] KEY_2_BYTES = LettuceConverters.toBytes(KEY_2); private static final byte[] KEY_3_BYTES = LettuceConverters.toBytes(KEY_3); + private static final byte[] KEY_4_BYTES = LettuceConverters.toBytes(KEY_4); private static final byte[] SAME_SLOT_KEY_1_BYTES = LettuceConverters.toBytes(SAME_SLOT_KEY_1); private static final byte[] SAME_SLOT_KEY_2_BYTES = LettuceConverters.toBytes(SAME_SLOT_KEY_2); @@ -91,6 +92,7 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests { private static final byte[] VALUE_1_BYTES = LettuceConverters.toBytes(VALUE_1); private static final byte[] VALUE_2_BYTES = LettuceConverters.toBytes(VALUE_2); private static final byte[] VALUE_3_BYTES = LettuceConverters.toBytes(VALUE_3); + private static final byte[] VALUE_4_BYTES = LettuceConverters.toBytes(VALUE_4); private static final GeoLocation ARIGENTO = new GeoLocation<>("arigento", POINT_ARIGENTO); private static final GeoLocation CATANIA = new GeoLocation<>("catania", POINT_CATANIA); @@ -179,7 +181,34 @@ void shouldCreateClusterConnectionWithPooling() { } finally { factory.destroy(); } + } + + @Test // GH-2888 + void shouldPipelineAdvancedClusterApi() { + + LettuceConnectionFactory factory = createConnectionFactory(); + + ConnectionVerifier.create(factory) // + .execute(connection -> { + + connection.set(KEY_1_BYTES, VALUE_1_BYTES); + connection.set(KEY_2_BYTES, VALUE_2_BYTES); + connection.set(KEY_4_BYTES, VALUE_4_BYTES); + connection.openPipeline(); + connection.keyCommands().randomKey(); + connection.stringCommands().mGet(KEY_1_BYTES, KEY_2_BYTES); + + List objects = connection.closePipeline(); + + assertThat(objects).hasSize(2); + assertThat(objects).element(0).isInstanceOf(byte[].class); + assertThat(objects).element(1).isInstanceOf(List.class); + + List mget = (List) objects.get(1); + assertThat(mget).containsExactly(VALUE_1_BYTES, VALUE_2_BYTES); + + }).verifyAndClose(); } @Test // DATAREDIS-315 @@ -1591,7 +1620,15 @@ public void randomKeyShouldReturnCorrectlyWhenKeysAvailable() { nativeConnection.set(KEY_1, VALUE_1); nativeConnection.set(KEY_2, VALUE_2); - assertThat(clusterConnection.randomKey()).isNotNull(); + for (int i = 0; i < 20; i++) { + + byte[] k = clusterConnection.randomKey(); + if (k == null) { + continue; + } + + assertThat(k).isIn(KEY_1_BYTES, KEY_2_BYTES); + } } @Test // DATAREDIS-315 @@ -2821,13 +2858,13 @@ void bitFieldIncrByWithOverflowShouldWorkCorrectly() { assertThat(clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L))) - .containsExactly(1L); + .containsExactly(1L); assertThat(clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L))) - .containsExactly(2L); + .containsExactly(2L); assertThat(clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L))) - .containsExactly(3L); + .containsExactly(3L); assertThat(clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L))).isNotNull(); } @@ -2837,7 +2874,7 @@ void bitfieldShouldAllowMultipleSubcommands() { assertThat(clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().incr(signed(5)).valueAt(BitFieldSubCommands.Offset.offset(100L)).by(1L).get(unsigned(4)).valueAt(0L))) - .containsExactly(1L, 0L); + .containsExactly(1L, 0L); } @Test // DATAREDIS-562 @@ -2847,13 +2884,13 @@ void bitfieldShouldWorkUsingNonZeroBasedOffset() { clusterConnection.stringCommands().bitField(LettuceConverters.toBytes(KEY_1), create().set(INT_8).valueAt(BitFieldSubCommands.Offset.offset(0L).multipliedByTypeLength()).to(100L) .set(INT_8).valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()).to(200L))) - .containsExactly(0L, 0L); + .containsExactly(0L, 0L); assertThat( clusterConnection.stringCommands() .bitField(LettuceConverters.toBytes(KEY_1), create().get(INT_8).valueAt(BitFieldSubCommands.Offset.offset(0L).multipliedByTypeLength()).get(INT_8) - .valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()))).containsExactly(100L, - -56L); + .valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()))) + .containsExactly(100L, -56L); } @Test // DATAREDIS-1103 @@ -2864,7 +2901,7 @@ void setKeepTTL() { assertThat( clusterConnection.stringCommands().set(KEY_1_BYTES, VALUE_2_BYTES, Expiration.keepTtl(), SetOption.upsert())) - .isTrue(); + .isTrue(); assertThat(nativeConnection.ttl(KEY_1)).isCloseTo(expireSeconds, Offset.offset(5L)); assertThat(nativeConnection.get(KEY_1)).isEqualTo(VALUE_2); 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 e1f1a52ff7..25fd46d783 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-2023 the original author or authors. + * Copyright 2015-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. @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; import static org.springframework.data.redis.connection.ClusterTestVariables.*; -import static org.springframework.data.redis.test.util.MockitoUtils.*; import io.lettuce.core.RedisFuture; import io.lettuce.core.RedisURI; @@ -46,6 +45,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; + import org.springframework.data.redis.connection.ClusterCommandExecutor; import org.springframework.data.redis.connection.ClusterNodeResourceProvider; import org.springframework.data.redis.connection.ClusterTopologyProvider; @@ -193,22 +193,6 @@ void isClosedShouldReturnConnectionStateCorrectly() { assertThat(connection.isClosed()).isTrue(); } - @Test // DATAREDIS-315 - void keysShouldBeRunOnAllClusterNodes() { - - when(clusterConnection1Mock.keys(any(byte[].class))).thenReturn(Collections. emptyList()); - when(clusterConnection2Mock.keys(any(byte[].class))).thenReturn(Collections. emptyList()); - when(clusterConnection3Mock.keys(any(byte[].class))).thenReturn(Collections. emptyList()); - - byte[] pattern = LettuceConverters.toBytes("*"); - - connection.keys(pattern); - - verify(clusterConnection1Mock, times(1)).keys(pattern); - verify(clusterConnection2Mock, times(1)).keys(pattern); - verify(clusterConnection3Mock, times(1)).keys(pattern); - } - @Test // DATAREDIS-315 void keysShouldOnlyBeRunOnDedicatedNodeWhenPinned() { @@ -223,38 +207,6 @@ void keysShouldOnlyBeRunOnDedicatedNodeWhenPinned() { verify(clusterConnection3Mock, never()).keys(pattern); } - @Test // DATAREDIS-315 - void randomKeyShouldReturnAnyKeyFromRandomNode() { - - when(clusterConnection1Mock.randomkey()).thenReturn(KEY_1_BYTES); - when(clusterConnection2Mock.randomkey()).thenReturn(KEY_2_BYTES); - when(clusterConnection3Mock.randomkey()).thenReturn(KEY_3_BYTES); - - assertThat(connection.randomKey()).isIn(KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES); - verifyInvocationsAcross("randomkey", times(1), clusterConnection1Mock, clusterConnection2Mock, - clusterConnection3Mock); - } - - @Test // DATAREDIS-315 - void randomKeyShouldReturnKeyWhenAvailableOnAnyNode() { - - when(clusterConnection3Mock.randomkey()).thenReturn(KEY_3_BYTES); - - for (int i = 0; i < 100; i++) { - assertThat(connection.randomKey()).isEqualTo(KEY_3_BYTES); - } - } - - @Test // DATAREDIS-315 - void randomKeyShouldReturnNullWhenNoKeysPresentOnAllNodes() { - - when(clusterConnection1Mock.randomkey()).thenReturn(null); - when(clusterConnection2Mock.randomkey()).thenReturn(null); - when(clusterConnection3Mock.randomkey()).thenReturn(null); - - assertThat(connection.randomKey()).isNull(); - } - @Test // DATAREDIS-315 void clusterSetSlotImportingShouldBeExecutedCorrectly() { 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 ed3c4d31ed..d347283a8b 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-2023 the original author or authors. + * Copyright 2019-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. 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 18dcf1da96..94cacb157f 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-2023 the original author or authors. + * Copyright 2021-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. 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 82eeda5e0a..3c91253f23 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-2023 the original author or authors. + * Copyright 2011-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. 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 6e1fb83fba..b4dd713fbe 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-2023 the original author or authors. + * Copyright 2015-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. @@ -1260,6 +1260,22 @@ void createRedisConfigurationWithValidRedisUriString() { .extracting(RedisStandaloneConfiguration::getPort).isEqualTo(6789); } + @Test // GH-2866 + void earlyStartupDoesNotStartConnectionFactory() { + + LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(new RedisStandaloneConfiguration(), + LettuceTestClientConfiguration.defaultConfiguration()); + connectionFactory.setEarlyStartup(false); + connectionFactory.afterPropertiesSet(); + + assertThat(connectionFactory.isEarlyStartup()).isFalse(); + assertThat(connectionFactory.isAutoStartup()).isTrue(); + assertThat(connectionFactory.isRunning()).isFalse(); + + AbstractRedisClient client = (AbstractRedisClient) getField(connectionFactory, "client"); + assertThat(client).isNull(); + } + static class CustomRedisConfiguration implements RedisConfiguration, WithHostAndPort { private String hostName; 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 d9843ef27e..7ca1190049 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-2023 the original author or authors. + * Copyright 2011-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. 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 516b23ff3e..1e4133d154 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-2023 the original author or authors. + * Copyright 2020-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. 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 aca02152c5..c9e702d2c0 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-2023 the original author or authors. + * Copyright 2011-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. 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 5c4cb0d888..e5e49d6a8b 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-2023 the original author or authors. + * Copyright 2020-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. 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 9e28ac0eb1..0ad92314da 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-2023 the original author or authors. + * Copyright 2013-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. 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 13f88fe454..0b6f1653ef 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-2023 the original author or authors. + * Copyright 2011-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. 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 1f88f8211f..0a6c19a166 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-2023 the original author or authors. + * Copyright 2014-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. @@ -18,15 +18,13 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; -import io.lettuce.core.RedisClient; -import io.lettuce.core.RedisFuture; -import io.lettuce.core.XAddArgs; -import io.lettuce.core.XClaimArgs; +import io.lettuce.core.*; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.async.RedisAsyncCommands; import io.lettuce.core.codec.ByteArrayCodec; import io.lettuce.core.codec.RedisCodec; import io.lettuce.core.codec.StringCodec; +import io.lettuce.core.output.ScanOutput; import io.lettuce.core.output.StatusOutput; import io.lettuce.core.protocol.AsyncCommand; import io.lettuce.core.protocol.Command; @@ -34,8 +32,12 @@ import io.lettuce.core.protocol.CommandType; import java.lang.reflect.InvocationTargetException; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -48,6 +50,9 @@ import org.springframework.data.redis.connection.RedisStreamCommands.XAddOptions; import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions; import org.springframework.data.redis.connection.stream.MapRecord; +import org.springframework.data.redis.connection.zset.Tuple; +import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.KeyScanOptions; import org.springframework.test.util.ReflectionTestUtils; /** @@ -247,6 +252,146 @@ void xaddShouldHonorNoMkStream() { assertThat(args.getValue()).extracting("nomkstream").isEqualTo(true); } + @Test // GH-2796 + void scanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + KeyScanCursor sc = new KeyScanCursor<>() { + @Override + public List getKeys() { + return List.of("spring".getBytes()); + } + }; + sc.setCursor(cursorId); + sc.setFinished(false); + + Command> command = new Command<>(new LettuceConnection.CustomCommandType("SCAN"), + new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + @Override + protected void setOutput(ByteBuffer bytes) { + + } + }); + AsyncCommand> future = new AsyncCommand<>(command); + future.complete(); + + when(asyncCommandsMock.scan(any(ScanCursor.class),any(ScanArgs.class))).thenReturn(future, future); + + Cursor cursor = connection.scan(KeyScanOptions.NONE); + cursor.next(); //initial + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + ArgumentCaptor captor = ArgumentCaptor.forClass(ScanCursor.class); + verify(asyncCommandsMock, times(2)).scan(captor.capture(), any(ScanArgs.class)); + assertThat(captor.getAllValues()).map(ScanCursor::getCursor).containsExactly("0", cursorId); + } + + @Test // GH-2796 + void sScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ValueScanCursor sc = new ValueScanCursor<>() { + @Override + public List getValues() { + return List.of("spring".getBytes()); + } + }; + sc.setCursor(cursorId); + sc.setFinished(false); + + Command> command = new Command<>(new LettuceConnection.CustomCommandType("SSCAN"), + new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + @Override + 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); + + Cursor cursor = connection.setCommands().sScan("key".getBytes(), KeyScanOptions.NONE); + cursor.next(); //initial + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + ArgumentCaptor captor = ArgumentCaptor.forClass(ScanCursor.class); + verify(asyncCommandsMock, times(2)).sscan(any(byte[].class), captor.capture(), any(ScanArgs.class)); + assertThat(captor.getAllValues()).map(ScanCursor::getCursor).containsExactly("0", cursorId); + } + + @Test // GH-2796 + void zScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + ScoredValueScanCursor sc = new ScoredValueScanCursor<>() { + @Override + public List> getValues() { + return List.of(ScoredValue.just(10D, "spring".getBytes())); + } + }; + sc.setCursor(cursorId); + sc.setFinished(false); + + Command> command = new Command<>(new LettuceConnection.CustomCommandType("ZSCAN"), + new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + @Override + 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); + + Cursor cursor = connection.zSetCommands().zScan("key".getBytes(), KeyScanOptions.NONE); + cursor.next(); //initial + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + ArgumentCaptor captor = ArgumentCaptor.forClass(ScanCursor.class); + verify(asyncCommandsMock, times(2)).zscan(any(byte[].class), captor.capture(), any(ScanArgs.class)); + assertThat(captor.getAllValues()).map(ScanCursor::getCursor).containsExactly("0", cursorId); + } + + @Test // GH-2796 + void hScanShouldOperateUponUnsigned64BitCursorId() { + + String cursorId = "9286422431637962824"; + MapScanCursor sc = new MapScanCursor<>() { + @Override + public Map getMap() { + return Map.of("spring".getBytes(), "data".getBytes()); + } + }; + sc.setCursor(cursorId); + sc.setFinished(false); + + Command> command = new Command<>(new LettuceConnection.CustomCommandType("HSCAN"), + new ScanOutput<>(ByteArrayCodec.INSTANCE, sc) { + @Override + 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); + + Cursor> cursor = connection.hashCommands().hScan("key".getBytes(), KeyScanOptions.NONE); + cursor.next(); //initial + assertThat(cursor.getCursorId()).isEqualTo(Long.parseUnsignedLong(cursorId)); + + cursor.next(); // fetch next + ArgumentCaptor captor = ArgumentCaptor.forClass(ScanCursor.class); + verify(asyncCommandsMock, times(2)).hscan(any(byte[].class), captor.capture(), any(ScanArgs.class)); + assertThat(captor.getAllValues()).map(ScanCursor::getCursor).containsExactly("0", cursorId); + } + } public static class LettucePipelineConnectionUnitTests extends BasicUnitTests { @@ -304,5 +449,29 @@ public void getClientNameShouldSendRequestCorrectly() { connection.getClientName(); verify(asyncCommandsMock).clientGetname(); } + + @Test + @Disabled("scan not supported in pipeline") + void scanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void sScanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void zScanShouldOperateUponUnsigned64BitCursorId() { + + } + + @Test + @Disabled("scan not supported in pipeline") + void hScanShouldOperateUponUnsigned64BitCursorId() { + + } } } 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 327c4bc0ba..0e4c15fffb 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-2023 the original author or authors. + * Copyright 2014-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. 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 383a68c918..85215098ff 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-2023 the original author or authors. + * 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. 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 d369c886fc..ebd84f545e 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-2023 the original author or authors. + * Copyright 2019-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. 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 e04f8326ed..5c439889b6 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-2023 the original author or authors. + * Copyright 2016-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. 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 06aa7232e1..3d94e4a394 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-2023 the original author or authors. + * Copyright 2016-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. 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 7f3dae3e67..4d08c1402d 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-2023 the original author or authors. + * Copyright 2016-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. 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 56381be6c8..6632a1f97c 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-2023 the original author or authors. + * Copyright 2016-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. 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 2e7251c91e..197a2b53a1 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-2023 the original author or authors. + * 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. @@ -195,7 +195,7 @@ void getConfigShouldRespondCorrectly() { connection.serverCommands().getConfig(NODE1, "*").as(StepVerifier::create) // .consumeNextWith(properties -> { - assertThat(properties).containsEntry("databases", "16"); + assertThat(properties).containsEntry("port", NODE1.getPort().toString()); }) // .verifyComplete(); } 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 071faec815..13848ee84c 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-2023 the original author or authors. + * Copyright 2016-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. 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 5209a10db2..d253e49cf9 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-2023 the original author or authors. + * Copyright 2016-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. 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 9b250f72aa..0bedf8273f 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-2023 the original author or authors. + * Copyright 2016-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. 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 fee8db144c..d06df9f15b 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-2023 the original author or authors. + * Copyright 2016-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. 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 4572794e89..f01cd12658 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-2023 the original author or authors. + * Copyright 2016-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. 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 970ebbf89d..e152cf6311 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-2023 the original author or authors. + * Copyright 2016-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. 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 01c153e09f..cdd9e99d8c 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-2023 the original author or authors. + * Copyright 2016-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. 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 29d5d16afa..457c009a60 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-2023 the original author or authors. + * Copyright 2016-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. 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 a56d0c6444..856466cfc0 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-2023 the original author or authors. + * Copyright 2016-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. 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 99bf16ca1a..cf072ff594 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-2023 the original author or authors. + * Copyright 2016-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. 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 e947b1cacc..c4013494ce 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 the original author or authors. + * Copyright 2022-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. 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 846e7c2064..4c4b6b7f7e 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-2023 the original author or authors. + * Copyright 2018-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. 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 80f176bb05..e8fe23e141 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-2023 the original author or authors. + * 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. 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 6886c21a5c..75a0b75a3a 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-2023 the original author or authors. + * 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. 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 0361f7dbff..09be137a6d 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-2023 the original author or authors. + * 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. @@ -201,8 +201,7 @@ void getConfigShouldRespondCorrectly() { connection.serverCommands().getConfig("*").as(StepVerifier::create) // .consumeNextWith(properties -> { - assertThat(properties).containsEntry("127.0.0.1:7379.databases", "16"); - + assertThat(properties).containsEntry("127.0.0.1:7379.port", "7379"); }) // .verifyComplete(); } else { @@ -215,6 +214,23 @@ void getConfigShouldRespondCorrectly() { } } + @ParameterizedRedisTest // GH-2798 + void setConfigShouldRespondCorrectly() { + + if (!(connection instanceof LettuceReactiveRedisClusterConnection)) { + + connection.serverCommands().setConfig("notify-keyspace-events", "") // + .as(StepVerifier::create) // + .expectNext("OK") + .verifyComplete(); + + connection.serverCommands().setConfig("notify-keyspace-events", "KEA") // + .as(StepVerifier::create) // + .expectNext("OK") + .verifyComplete(); + } + } + @ParameterizedRedisTest // DATAREDIS-659 void setConfigShouldApplyConfiguration() { 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 a534f82723..394cb5cba9 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-2023 the original author or authors. + * Copyright 2016-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. 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 9abc3a5d4c..9fb4d8401b 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-2023 the original author or authors. + * Copyright 2018-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. 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 d80c426338..15548cfc22 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-2023 the original author or authors. + * Copyright 2016-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. 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 eb0cdac046..9583d1f760 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-2023 the original author or authors. + * Copyright 2018-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. 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 fce69f8dae..78b69f568d 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-2023 the original author or authors. + * Copyright 2016-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. 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 aaaa6c1537..3785f6fdcb 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-2023 the original author or authors. + * Copyright 2014-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. 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 5890ecabd9..7c119c3d03 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-2023 the original author or authors. + * Copyright 2015-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. 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 83bd5c0234..4c1ba0f9ec 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-2023 the original author or authors. + * Copyright 2011-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. 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 504ffec794..086ccf86b0 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-2023 the original author or authors. + * 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. 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 e94358a25f..00ab6acf52 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-2023 the original author or authors. + * Copyright 2020-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. 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 ae9ef247b9..c585c5d3ee 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-2023 the original author or authors. + * Copyright 2022-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. 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 38450c4709..9e5f14a6ce 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-2023 the original author or authors. + * Copyright 2014-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. 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 ff9e0be5de..791c6b312e 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-2023 the original author or authors. + * Copyright 2020-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. 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 aa5a1a19c7..cdbaf8661a 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-2023 the original author or authors. + * Copyright 2022-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. 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 1e1f5fa19b..52bbd0b03f 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-2023 the original author or authors. + * Copyright 2022-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. 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 4849890fac..af6c481cad 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-2023 the original author or authors. + * Copyright 2022-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. 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 3a32f0cd23..4ee7bc9dfb 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-2023 the original author or authors. + * Copyright 2020-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. 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 f3bc58c96f..4fdc618f8a 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-2023 the original author or authors. + * Copyright 2013-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. 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 0d5d663f24..c7d763a449 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-2023 the original author or authors. + * Copyright 2022-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. 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 6c94e03fd9..5b98034fbd 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-2023 the original author or authors. + * Copyright 2022-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. 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 92940d9a76..af5f87b504 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-2023 the original author or authors. + * Copyright 2021-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. 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 e6499c8e27..c8b83d3a07 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-2023 the original author or authors. + * Copyright 2014-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. 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 c44c83add0..a228f7b589 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-2023 the original author or authors. + * 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. 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 2a4abd261f..e2deedc846 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-2023 the original author or authors. + * Copyright 2015-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. 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 f640de1739..d299c8378f 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-2023 the original author or authors. + * Copyright 2016-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. 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 62c0013b43..fe79d8d014 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-2023 the original author or authors. + * Copyright 2013-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. 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 4f177055ed..3ac0a643d4 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-2023 the original author or authors. + * Copyright 2014-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. 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 03e1652db6..559551a4b0 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-2023 the original author or authors. + * Copyright 2013-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. 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 47b74b7aff..cd9411b4ef 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-2023 the original author or authors. + * 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. 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 b0aa6c085f..d844370bfb 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-2023 the original author or authors. + * 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. 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 881dcee6a6..a52d2e20d3 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-2023 the original author or authors. + * 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. 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 1d24e6431a..92fcd6d783 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-2023 the original author or authors. + * 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. 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 8b4a3e827f..6ffeb10725 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-2023 the original author or authors. + * 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. 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 9b7ec7d077..c6040d795c 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-2023 the original author or authors. + * Copyright 2018-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. 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 b3c8a29a2a..b1f44caf21 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-2023 the original author or authors. + * 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. 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 2975ed8100..6512faaae8 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-2023 the original author or authors. + * 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. 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 ce87733888..d4bf27f48b 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-2023 the original author or authors. + * Copyright 2013-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. 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 58e3ee3c31..eb2cb33079 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-2023 the original author or authors. + * Copyright 2018-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. 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 97bc494a83..fa8beb2b52 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-2023 the original author or authors. + * Copyright 2014-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. 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 93aa564ee7..e539412d5a 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-2023 the original author or authors. + * Copyright 2013-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. 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 631b9ab5fa..1a84eb956d 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-2023 the original author or authors. + * Copyright 2016-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. 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 425b3d6295..853b0d698f 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-2023 the original author or authors. + * Copyright 2013-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. 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 ac49f31478..02462003c2 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-2023 the original author or authors. + * Copyright 2021-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. 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 a53bf1c498..b1d41586a1 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-2023 the original author or authors. + * Copyright 2015-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. 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 4c6b1a4648..7981efec59 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-2023 the original author or authors. + * Copyright 2014-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. 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 f013e73e3f..8364be9311 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-2023 the original author or authors. + * 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. 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 b3b80ffa3e..37fabc7b30 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-2023 the original author or authors. + * 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. 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 f2a5b8c0a3..f27299b272 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-2023 the original author or authors. + * Copyright 2019-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. 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 503f3d8d69..b41ee3dc4e 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-2023 the original author or authors. + * 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. 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 c427030e94..d1f9f4d800 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-2023 the original author or authors. + * 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. 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 d2bf4f1a61..4a17444966 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-2023 the original author or authors. + * Copyright 2015-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. 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 60638ae0f6..92c4ab693e 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-2023 the original author or authors. + * Copyright 2014-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. 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 d8b8925945..19854032ff 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-2023 the original author or authors. + * Copyright 2020-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. @@ -24,6 +24,7 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisKeyCommands; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionException; import org.springframework.transaction.support.AbstractPlatformTransactionManager; @@ -201,6 +202,45 @@ void bindConnectionShouldNotBindConnectionToTransaction() { assertThat(TransactionSynchronizationManager.hasResource(factoryMock)).isFalse(); } + @Test // GH-2886 + void connectionProxyShouldInvokeReadOnlyMethods() { + + TransactionTemplate template = new TransactionTemplate(new DummyTransactionManager()); + + byte[] anyBytes = new byte[] { 1, 2, 3 }; + when(connectionMock2.exists(anyBytes)).thenReturn(true); + + template.executeWithoutResult(status -> { + + RedisConnection connection = RedisConnectionUtils.getConnection(factoryMock, true); + + assertThat(connection.exists(anyBytes)).isEqualTo(true); + }); + } + + @Test // GH-2886 + void connectionProxyShouldConsiderCommandInterfaces() { + + TransactionTemplate template = new TransactionTemplate(new DummyTransactionManager()); + + byte[] anyBytes = new byte[] { 1, 2, 3 }; + + RedisKeyCommands commandsMock = mock(RedisKeyCommands.class); + + when(connectionMock1.keyCommands()).thenReturn(commandsMock); + when(connectionMock2.keyCommands()).thenReturn(commandsMock); + when(commandsMock.exists(anyBytes)).thenReturn(true); + when(commandsMock.del(anyBytes)).thenReturn(42L); + + template.executeWithoutResult(status -> { + + RedisConnection connection = RedisConnectionUtils.getConnection(factoryMock, true); + + assertThat(connection.keyCommands().exists(anyBytes)).isEqualTo(true); + assertThat(connection.keyCommands().del(anyBytes)).isEqualTo(42L); + }); + } + static class DummyTransactionManager extends AbstractPlatformTransactionManager { @Override 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 e189dc2175..6ab8ab530b 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-2023 the original author or authors. + * Copyright 2018-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. 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 d9ac4c7321..1e23e01c6e 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-2023 the original author or authors. + * Copyright 2015-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. @@ -91,6 +91,7 @@ void setUp() { RedisConnection connection = template.getConnectionFactory().getConnection(); try { + connection.setConfig("notify-keyspace-events", ""); connection.setConfig("notify-keyspace-events", "KEA"); } finally { connection.close(); @@ -146,6 +147,25 @@ void putWritesSimpleIndexDataCorrectly() { assertThat(template.opsForSet().members("persons:firstname:rand")).contains("1"); } + @Test // GH-2882 + void indexDataShouldBeClearedIfPropertyValueIsSetToNull() { + + Person rand = new Person(); + rand.firstname = "rand"; + + adapter.put("1", rand, "persons"); + + assertThat(template.keys("persons*")).contains("persons:firstname:rand"); + assertThat(template.opsForSet().members("persons:firstname:rand")).contains("1"); + + rand.id = "1"; + rand.firstname = null; + adapter.put("1", rand, "persons"); + + assertThat(template.keys("persons*")).doesNotContain("persons:firstname:rand"); + assertThat(template.opsForSet().members("persons:firstname:rand")).doesNotContain("1"); + } + @Test // DATAREDIS-744 void putWritesSimpleIndexDataWithColonCorrectly() { 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 68fa93a423..b992cb5fa4 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-2023 the original author or authors. + * Copyright 2016-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. 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 e26afc6442..ab19b6522c 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-2023 the original author or authors. + * Copyright 2015-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. 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 755c4380c7..bbc18c6f0e 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-2023 the original author or authors. + * Copyright 2013-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. @@ -361,8 +361,7 @@ public Object execute(RedisOperations operations) throws DataAccessException { try { // Await EXEC completion as it's executed on a dedicated connection. Thread.sleep(100); - } catch (InterruptedException ignore) { - } + } catch (InterruptedException ignore) {} operations.opsForValue().set(key1, value1); operations.opsForValue().get(key1); @@ -673,7 +672,16 @@ void testRandomKey() { K key1 = keyFactory.instance(); V value1 = valueFactory.instance(); redisTemplate.opsForValue().set(key1, value1); - assertThat(redisTemplate.randomKey()).isEqualTo(key1); + + for (int i = 0; i < 20; i++) { + + K k = redisTemplate.randomKey(); + if (k == null) { + continue; + } + + assertThat(k).isEqualTo(key1); + } } @ParameterizedRedisTest @@ -723,8 +731,7 @@ public List execute(RedisOperations operations) throws DataAccessExcepti th.start(); try { th.join(); - } catch (InterruptedException ignore) { - } + } catch (InterruptedException ignore) {} operations.multi(); operations.opsForValue().set(key1, value3); @@ -756,8 +763,7 @@ public List execute(RedisOperations operations) throws DataAccessExcepti th.start(); try { th.join(); - } catch (InterruptedException ignore) { - } + } catch (InterruptedException ignore) {} operations.unwatch(); operations.multi(); @@ -794,8 +800,7 @@ public List execute(RedisOperations operations) throws DataAccessExcepti th.start(); try { th.join(); - } catch (InterruptedException ignore) { - } + } catch (InterruptedException ignore) {} operations.multi(); operations.opsForValue().set(key1, value3); 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 c51e94ea7f..9b22293cf6 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-2023 the original author or authors. + * Copyright 2014-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. 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 0d61153537..bcbecdea3a 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-2023 the original author or authors. + * Copyright 2014-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. @@ -236,9 +236,9 @@ void streamingCursorShouldForwardClose() { @Test // GH-2414 void shouldCloseCursorOnScanFailure() { - KeyBoundCursor cursor = new KeyBoundCursor("foo".getBytes(), 0, null) { + KeyBoundCursor cursor = new KeyBoundCursor("foo".getBytes(), Cursor.CursorId.initial(), null) { @Override - protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) { + protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) { throw new IllegalStateException(); } }; @@ -255,7 +255,8 @@ private CapturingCursorDummy initCursor(Queue> values) { } private ScanIteration createIteration(long cursorId, String... values) { - return new ScanIteration<>(cursorId, values.length > 0 ? Arrays.asList(values) : Collections. emptyList()); + return new ScanIteration<>(Cursor.CursorId.of(cursorId), + values.length > 0 ? Arrays.asList(values) : Collections. emptyList()); } private static class CapturingCursorDummy extends ScanCursor { @@ -267,12 +268,12 @@ private static class CapturingCursorDummy extends ScanCursor { } @Override - protected ScanIteration doScan(long cursorId, ScanOptions options) { + protected ScanIteration doScan(CursorId cursorId, ScanOptions options) { ScanIteration iteration = this.values.poll(); if (iteration == null) { - iteration = new ScanIteration<>(0, Collections.emptyList()); + iteration = new ScanIteration<>(CursorId.initial(), Collections.emptyList()); } return iteration; } 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 73a3920c9d..7b87af8ff0 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-2023 the original author or authors. + * Copyright 2011-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. 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 b7832141de..91ec24027f 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-2023 the original author or authors. + * Copyright 2013-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. 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 93f0a29148..99723e9229 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-2023 the original author or authors. + * Copyright 2018-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. 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 182efad66a..d859bee0d1 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-2023 the original author or authors. + * Copyright 2016-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. 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 42c7eac7a4..41ce475264 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-2023 the original author or authors. + * Copyright 2015-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. 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 212c04105b..fa5943e91c 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-2023 the original author or authors. + * 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. 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 d733087bd4..a95ca213ee 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 the original author or authors. + * Copyright 2023-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. 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 270a73d7ee..f115d1eb4e 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-2023 the original author or authors. + * Copyright 2018-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. 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 8583dd5257..aff41be615 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-2023 the original author or authors. + * Copyright 2015-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. 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 e2a117cf21..8fa29d33c0 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-2023 the original author or authors. + * Copyright 2015-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. 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 a7e6735680..46c11631a3 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-2023 the original author or authors. + * Copyright 2016-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. 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 afd616309f..9201e0b7cb 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-2023 the original author or authors. + * Copyright 2015-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. 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 3a7cac75cc..f26bbf93da 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-2023 the original author or authors. + * Copyright 2016-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. 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 769f6c7b1e..bf3e1d2ef7 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-2023 the original author or authors. + * Copyright 2015-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. 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 402df2c95c..9d78ac4a69 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-2023 the original author or authors. + * Copyright 2015-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. 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 6cec43b7c6..e6c8b3ce36 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-2023 the original author or authors. + * Copyright 2013-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. 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 ac89246a85..7990d1a145 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-2023 the original author or authors. + * 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. 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 6cc75afaaa..2c68eca8d7 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-2023 the original author or authors. + * 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. 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 54c4f0c684..a8b7c14797 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-2023 the original author or authors. + * Copyright 2013-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. 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 30deebc0f0..40283a20f4 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-2023 the original author or authors. + * Copyright 2014-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. 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 278fe0e92c..c9ba2e0eea 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-2023 the original author or authors. + * Copyright 2014-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. 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 626055a455..a269a87203 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-2023 the original author or authors. + * Copyright 2014-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. 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 bd4773dc7b..681ca84b26 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-2023 the original author or authors. + * Copyright 2016-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. 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 ea4600448c..893f9915ab 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-2023 the original author or authors. + * Copyright 2014-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. 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 6ee3411c2f..ab40d19bc7 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 the original author or authors. + * Copyright 2023-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. 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 ad98181793..4cac7b2eb1 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 the original author or authors. + * Copyright 2023-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. 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 a7998c49e8..21b01e228d 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 the original author or authors. + * Copyright 2023-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. 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 dc4b13e02c..1ce50709dc 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-2023 the original author or authors. + * Copyright 2015-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. 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 23aa307f03..6402df5c4a 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-2023 the original author or authors. + * Copyright 2015-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. 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 ec30f6d381..4b79d20d6a 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-2023 the original author or authors. + * Copyright 2020-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. 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 fe5db12839..378c030499 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-2023 the original author or authors. + * Copyright 2011-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. 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 bc138ab2e7..78d03c6b1f 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-2023 the original author or authors. + * Copyright 2011-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. 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 f163b6b1a8..4f577dd447 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-2023 the original author or authors. + * Copyright 2011-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. 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 8abe6cdb68..e1e71a7560 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-2023 the original author or authors. + * Copyright 2018-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. 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 8d517f6f10..0e167fc65c 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-2023 the original author or authors. + * Copyright 2018-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. 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 7f572da2b7..256c5f65dd 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-2023 the original author or authors. + * Copyright 2018-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. 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 f2df685c88..59b0d9bd52 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-2023 the original author or authors. + * Copyright 2016-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. 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 e8aed73f95..4e4f571476 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-2023 the original author or authors. + * Copyright 2016-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. 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 ebb268dcc8..7d71909c71 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-2023 the original author or authors. + * Copyright 2018-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. @@ -19,10 +19,15 @@ import static org.mockito.Mockito.*; import java.nio.charset.StandardCharsets; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + +import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.core.task.SyncTaskExecutor; import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.connection.RedisConnection; @@ -32,6 +37,7 @@ import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; import org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException; +import org.springframework.util.backoff.FixedBackOff; /** * Unit tests for {@link RedisMessageListenerContainer}. @@ -147,6 +153,70 @@ void containerListenShouldReportFailureOnRedisUnavailability() { assertThat(container.isListening()).isFalse(); } + @Test // GH-2335 + void shouldRecoverFromConnectionFailure() throws Exception { + + AtomicInteger requestCount = new AtomicInteger(); + AtomicBoolean shouldThrowSubscriptionException = new AtomicBoolean(); + + container = new RedisMessageListenerContainer(); + container.setConnectionFactory(connectionFactoryMock); + container.setBeanName("container"); + container.setTaskExecutor(new SyncTaskExecutor()); + container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor()); + container.setMaxSubscriptionRegistrationWaitingTime(1000); + container.setRecoveryBackoff(new FixedBackOff(1, 5)); + container.afterPropertiesSet(); + + doAnswer(it -> { + + int req = requestCount.incrementAndGet(); + if (req == 1 || req == 3) { + return connectionMock; + } + + throw new RedisConnectionFailureException("Booh"); + }).when(connectionFactoryMock).getConnection(); + + CountDownLatch exceptionWait = new CountDownLatch(1); + CountDownLatch armed = new CountDownLatch(1); + CountDownLatch recoveryArmed = new CountDownLatch(1); + + doAnswer(it -> { + + SubscriptionListener listener = it.getArgument(0); + when(connectionMock.isSubscribed()).thenReturn(true); + + listener.onChannelSubscribed("a".getBytes(StandardCharsets.UTF_8), 1); + + armed.countDown(); + exceptionWait.await(); + + if (shouldThrowSubscriptionException.compareAndSet(true, false)) { + when(connectionMock.isSubscribed()).thenReturn(false); + throw new RedisConnectionFailureException("Disconnected"); + } + + recoveryArmed.countDown(); + + return null; + }).when(connectionMock).subscribe(any(), any()); + + container.start(); + container.addMessageListener(new MessageListenerAdapter(handler), new ChannelTopic("a")); + armed.await(); + + // let an exception happen + shouldThrowSubscriptionException.set(true); + exceptionWait.countDown(); + + // wait for subscription recovery + recoveryArmed.await(); + + assertThat(recoveryArmed.getCount()).isZero(); + + } + @Test // GH-964 void failsOnDuplicateInit() { assertThatIllegalStateException().isThrownBy(() -> container.afterPropertiesSet()); 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 3691d835eb..4d0701a3ea 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-2023 the original author or authors. + * Copyright 2011-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. 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 149806bffb..ffa2f25f3c 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-2023 the original author or authors. + * Copyright 2011-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. 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 ae27fae60d..a8735c93ec 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-2023 the original author or authors. + * Copyright 2011-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. 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 cb59ed8aae..6536e0e79c 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-2023 the original author or authors. + * Copyright 2011-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. 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 bfc74e9bc5..0d6465b656 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-2023 the original author or authors. + * Copyright 2011-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. 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 852b70b393..af3cefe216 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-2023 the original author or authors. + * Copyright 2011-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. 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 432bad71cf..94d7488762 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-2023 the original author or authors. + * Copyright 2011-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. 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 deacc04081..593d7ec594 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 the original author or authors. + * Copyright 2023-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. 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 4d6a31a2d6..608132504c 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-2023 the original author or authors. + * Copyright 2016-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. 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 0bfd004615..18c2f2b69b 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 the original author or authors. + * Copyright 2023-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. 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 5cf25ac39b..4ca104122f 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-2023 the original author or authors. + * Copyright 2016-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. 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 1888d8ec68..31b74f2d57 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-2023 the original author or authors. + * Copyright 2016-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. 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 4044f3904d..b02fea7953 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-2023 the original author or authors. + * Copyright 2016-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. 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 6fd2ad1341..94009df445 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-2023 the original author or authors. + * Copyright 2016-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. @@ -27,6 +27,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Reference; @@ -50,6 +51,7 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.QueryByExampleExecutor; +import org.springframework.data.util.Streamable; import org.springframework.lang.Nullable; /** @@ -101,6 +103,71 @@ void simpleFindShouldReturnEntitiesCorrectly() { assertThat(repo.findByLastname("al'thor")).contains(rand); } + @Test // GH-2851 + void shouldReturnSingleEntityByIdViaQueryMethod() { + + Person rand = new Person(); + rand.firstname = "rand"; + rand.lastname = "al'thor"; + + Person egwene = new Person(); + egwene.firstname = "egwene"; + + repo.saveAll(Arrays.asList(rand, egwene)); + + assertThat(repo.findEntityById(rand.getId())).isEqualTo(rand); + assertThat(repo.findEntityById(egwene.getId())).isEqualTo(egwene); + } + + @Test // GH-2851 + void shouldProjectSingleResult() { + + Person rand = new Person(); + rand.firstname = "rand"; + rand.lastname = "al'thor"; + + Person egwene = new Person(); + egwene.firstname = "egwene"; + + repo.saveAll(Arrays.asList(rand, egwene)); + + PersonProjection projection = repo.findProjectionById(rand.getId(), PersonProjection.class); + assertThat(projection).isNotNull(); + assertThat(projection.getFirstname()).isEqualTo(rand.firstname); + + PersonDto dto = repo.findProjectionById(rand.getId(), PersonDto.class); + assertThat(dto).isNotNull(); + assertThat(dto.firstname()).isEqualTo(rand.firstname); + } + + @Test // GH-2851 + void shouldProjectCollection() { + + Person rand = new Person(); + rand.firstname = "rand"; + rand.lastname = "al'thor"; + + Person egwene = new Person(); + egwene.firstname = "egwene"; + + repo.saveAll(Arrays.asList(rand, egwene)); + + List projection = repo.findProjectionBy(); + assertThat(projection).hasSize(2) // + .extracting(PersonProjection::getFirstname) // + .contains(rand.getFirstname(), egwene.getFirstname()); + + projection = repo.findProjectionStreamBy().toList(); + assertThat(projection).hasSize(2) // + .extracting(PersonProjection::getFirstname) // + .contains(rand.getFirstname(), egwene.getFirstname()); + + List dtos = repo.findProjectionDtoBy(); + assertThat(dtos).hasSize(2) // + .extracting(PersonDto::firstname) // + .contains(rand.getFirstname(), egwene.getFirstname()); + } + @Test // DATAREDIS-425 void simpleFindByMultipleProperties() { @@ -268,6 +335,25 @@ void shouldApplyPageableCorrectlyWhenUsingFindByWithoutCriteria() { assertThat(repo.findBy(firstPage.nextPageable()).getContent()).hasSize(1); } + @Test // GH-2799 + void shouldReturnEntitiesWithoutDuplicates() { + + Person eddard = new Person("eddard", "stark"); + eddard.setAlive(true); + + Person robb = new Person("robb", "stark"); + robb.setAlive(false); + + Person jon = new Person("jon", "snow"); + jon.setAlive(true); + + repo.saveAll(Arrays.asList(eddard, robb, jon)); + + List result = repo.findByFirstnameAndLastnameOrAliveIsTrue("eddard", "stark"); + assertThat(result).hasSize(2); + assertThat(result).contains(eddard, jon); + } + @Test // DATAREDIS-771 void shouldFindByBooleanIsTrue() { @@ -537,6 +623,8 @@ public interface PersonRepository extends PagingAndSortingRepository findByFirstnameOrLastname(String firstname, String lastname); + List findByFirstnameAndLastnameOrAliveIsTrue(String firstname, String lastname); + List findFirstBy(); List findTop2By(); @@ -549,10 +637,27 @@ public interface PersonRepository extends PagingAndSortingRepository findByHometownLocationNear(Point point, Distance distance, Pageable pageable); + Person findEntityById(String id); + + T findProjectionById(String id, Class projection); + + Streamable findProjectionStreamBy(); + + List findProjectionBy(); + + List findProjectionDtoBy(); + @Override List findAll(Example example); } + public interface PersonProjection { + String getFirstname(); + } + + record PersonDto(String firstname) { + } + public interface CityRepository extends CrudRepository { List findByLocationNear(Point point, Distance distance); 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 3bab07e22f..120fdc4c96 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-2023 the original author or authors. + * Copyright 2015-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. 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 ab55ad38fa..dfbbffd692 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-2023 the original author or authors. + * Copyright 2016-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. 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 c823707af3..8083246095 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-2023 the original author or authors. + * Copyright 2016-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. 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 0a74985e26..237f08a970 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-2023 the original author or authors. + * Copyright 2016-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. 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 ad4b927253..a5d81e8c00 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-2023 the original author or authors. + * Copyright 2016-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. 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 1ac5990da8..8bfc9c50ab 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-2023 the original author or authors. + * Copyright 2016-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. 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 ccb4bb481c..ac82b1b4fe 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-2023 the original author or authors. + * Copyright 2016-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. 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 c8735a86b3..c04bf3d6bb 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-2023 the original author or authors. + * Copyright 2016-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. 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 003b8fbd7e..88c310e7e4 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-2023 the original author or authors. + * Copyright 2016-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. 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 18ca438fbe..300f37f818 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-2023 the original author or authors. + * Copyright 2016-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. 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 34b0efaa78..008cb091e3 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-2023 the original author or authors. + * Copyright 2016-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. 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 d229d1fa8b..b2a21f454f 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-2023 the original author or authors. + * Copyright 2016-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. 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 367301c6fc..746a7e4cca 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-2023 the original author or authors. + * Copyright 2016-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. 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 38439bef62..445beb8f38 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-2023 the original author or authors. + * Copyright 2018-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. 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 bdf8cdd604..8cd54ae12c 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-2023 the original author or authors. + * Copyright 2016-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. @@ -38,6 +38,7 @@ import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.query.DefaultParameters; import org.springframework.data.repository.query.ParametersParameterAccessor; +import org.springframework.data.repository.query.ParametersSource; import org.springframework.data.repository.query.parser.PartTree; /** @@ -193,7 +194,7 @@ private RedisQueryCreator createQueryCreatorForMethodWithArgs(Method method, Obj PartTree partTree = new PartTree(method.getName(), method.getReturnType()); RedisQueryCreator creator = new RedisQueryCreator(partTree, - new ParametersParameterAccessor(new DefaultParameters(method), args)); + new ParametersParameterAccessor(new DefaultParameters(ParametersSource.of(method)), args)); return creator; } 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 d8cb08af61..ebcec9b870 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-2023 the original author or authors. + * Copyright 2018-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. @@ -15,9 +15,7 @@ */ package org.springframework.data.redis.repository.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.*; import java.util.Arrays; import java.util.List; @@ -57,7 +55,7 @@ * @author Christoph Strobl * @author John Blum */ -public class QueryByExampleRedisExecutorIntegrationTests { +class QueryByExampleRedisExecutorIntegrationTests { private static JedisConnectionFactory connectionFactory; private RedisMappingContext mappingContext = new RedisMappingContext(); @@ -129,7 +127,7 @@ void shouldNotFindOneByExample() { assertThat(result).isEmpty(); } - @Test // DATAREDIS-605 + @Test // DATAREDIS-605, GH-2880 void shouldFindAllByExample() { QueryByExampleRedisExecutor executor = new QueryByExampleRedisExecutor<>(getEntityInformation(Person.class), @@ -138,7 +136,7 @@ void shouldFindAllByExample() { Person person = new Person(); person.setHometown(walt.getHometown()); - Iterable result = executor.findAll(Example.of(person)); + List result = executor.findAll(Example.of(person)); assertThat(result).contains(walt, gus, hank); } 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 b7c870541d..7be9d472cf 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-2023 the original author or authors. + * 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. 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 f690036ddf..440c45ac04 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-2023 the original author or authors. + * 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. 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 9f873e09bc..7f54a324cf 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-2023 the original author or authors. + * Copyright 2015-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. 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 b5e225e1f7..dab08d2c0c 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-2023 the original author or authors. + * Copyright 2014-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. 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 add9744c42..e435f57b6e 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-2023 the original author or authors. + * 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. 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 8121721351..46e5712ba1 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-2023 the original author or authors. + * Copyright 2016-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. 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 4d73ccc35f..af21b6a1fb 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-2023 the original author or authors. + * Copyright 2011-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. 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 ad0ced1e6f..88c99848a8 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-2023 the original author or authors. + * 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. 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 f401e5d2b9..8df2d894f9 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-2023 the original author or authors. + * Copyright 2018-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. 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 09995a3939..e8c2ed56ec 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-2023 the original author or authors. + * Copyright 2018-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. 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 d58a1f9dd9..5a6357fefe 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-2023 the original author or authors. + * Copyright 2018-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. 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 ef3e654f56..dac2fe205f 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-2023 the original author or authors. + * Copyright 2018-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. 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 3352f6de8f..5abe16c2c3 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-2023 the original author or authors. + * Copyright 2018-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. 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 4b38016148..e193f58618 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-2023 the original author or authors. + * Copyright 2011-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. 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 4c9a42051d..3624336f2c 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-2023 the original author or authors. + * Copyright 2011-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. 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 9d4eb22176..f958c93fce 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-2023 the original author or authors. + * Copyright 2011-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. 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 effb514821..0d4b899cf2 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-2023 the original author or authors. + * Copyright 2018-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. 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 4907242640..6a1302c0c9 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-2023 the original author or authors. + * Copyright 2013-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. 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 8e0db748b1..c504e5fe61 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-2023 the original author or authors. + * Copyright 2018-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. 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 eeb074ee82..cd7a4332bf 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-2023 the original author or authors. + * Copyright 2013-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. 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 49c42cfdcb..eeb14ccc2f 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-2023 the original author or authors. + * Copyright 2018-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. 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 fa82ebf09e..21e22125a6 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-2023 the original author or authors. + * Copyright 2013-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. 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 620b1840a3..cd4a349183 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-2023 the original author or authors. + * Copyright 2018-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. 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 a6d2f78fba..5f6b5ca85b 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-2023 the original author or authors. + * Copyright 2011-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. 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 fb67ea63b3..47f75e4576 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-2023 the original author or authors. + * Copyright 2014-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. 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 2176bb09ab..1306f0d795 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-2023 the original author or authors. + * Copyright 2011-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. 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 364eb7fa44..3f4e17d439 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-2023 the original author or authors. + * Copyright 2011-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. 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 7e82493e9d..60e839548e 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-2023 the original author or authors. + * Copyright 2011-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. 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 fb85f4bf31..20e647c45f 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-2023 the original author or authors. + * Copyright 2011-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. 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 9b8761ae3a..3ea95932a5 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-2023 the original author or authors. + * Copyright 2011-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. 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 1c86122ffe..f946511750 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-2023 the original author or authors. + * Copyright 2018-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. 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 6af4a1fdfa..4075821b4e 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-2023 the original author or authors. + * Copyright 2011-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. 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 2d5a0138a0..9102a0f1a8 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-2023 the original author or authors. + * Copyright 2011-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. 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 8124f45114..d6ac4b7911 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-2023 the original author or authors. + * Copyright 2011-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. 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 dc628a7a1f..9f4fd59b7f 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-2023 the original author or authors. + * Copyright 2011-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. 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 974a99eb75..cde7e8d8dc 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-2023 the original author or authors. + * Copyright 2011-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. 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 b53b0e8984..86b3fa4a50 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-2023 the original author or authors. + * Copyright 2011-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. 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 bd7861f0bb..656b8966d9 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-2023 the original author or authors. + * Copyright 2011-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. 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 29951d0922..ee03b5711c 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-2023 the original author or authors. + * Copyright 2020-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. 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 2672b185bf..436be6983a 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-2023 the original author or authors. + * Copyright 2020-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. 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 fe3ddcbd6b..346c359987 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-2023 the original author or authors. + * Copyright 2020-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. 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 d2f28c293b..9d5887ec63 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-2023 the original author or authors. + * Copyright 2020-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. 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 3d27b8e1aa..a5f3c31411 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-2023 the original author or authors. + * Copyright 2020-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. 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 0b3e29c170..f1c73953df 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-2023 the original author or authors. + * Copyright 2020-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. 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 1d3015e5f8..feebd4ad6d 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-2023 the original author or authors. + * Copyright 2020-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. 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 6a2fd640b8..f67cf4d3f8 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-2023 the original author or authors. + * Copyright 2020-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. 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 1b46dd6e69..c904ae9543 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-2023 the original author or authors. + * Copyright 2020-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. 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 fb85bfe3bc..d4fbf0e78b 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-2023 the original author or authors. + * Copyright 2020-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. 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 2f1ae0cc4c..b2f225026f 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-2023 the original author or authors. + * Copyright 2020-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. 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 13bce43cd8..9a59d80ba8 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-2023 the original author or authors. + * Copyright 2020-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. 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 3276d6f1d5..e3c6ab3d67 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-2023 the original author or authors. + * Copyright 2020-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. 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 5a082873be..f23bfd11aa 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-2023 the original author or authors. + * Copyright 2020-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. 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 9e4fa7bcbc..ce1495bcf0 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-2023 the original author or authors. + * Copyright 2020-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. 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 c63a79808c..26c5d1d29c 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-2023 the original author or authors. + * Copyright 2020-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. 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 5413a35e3b..5195c3f28a 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-2023 the original author or authors. + * Copyright 2020-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. 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 584b6bcd24..6c0240275f 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-2023 the original author or authors. + * Copyright 2020-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. 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 d438926b3d..cd77b39ee4 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-2023 the original author or authors. + * Copyright 2020-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. 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 1c7018765c..a87cb5f1dc 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-2023 the original author or authors. + * Copyright 2020-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. 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 03a0c396fd..8cdc9be407 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-2023 the original author or authors. + * Copyright 2020-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. 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 6ac742db82..10c2c236a9 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-2023 the original author or authors. + * Copyright 2020-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. 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 ab9e7246a0..c589838987 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-2023 the original author or authors. + * Copyright 2020-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. 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 295679f256..625b518465 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-2023 the original author or authors. + * Copyright 2020-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. 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 2841216c3f..8f8d760351 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-2023 the original author or authors. + * Copyright 2020-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. 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 17a0bf9acd..ed3b602908 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-2023 the original author or authors. + * Copyright 2020-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. 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 6723c48da0..4c9bc494b9 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-2023 the original author or authors. + * Copyright 2020-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. 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 e9f8cb5252..9f80af0bc8 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-2023 the original author or authors. + * Copyright 2020-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. 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 fe4ace599c..7b89c271bb 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-2023 the original author or authors. + * Copyright 2020-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. 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 c177bbf600..af4e61eb18 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-2023 the original author or authors. + * Copyright 2020-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. 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 5c6ab3b9c1..5e3b365405 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-2023 the original author or authors. + * Copyright 2020-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. 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 b8b15b57d8..d67c7399ac 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-2023 the original author or authors. + * Copyright 2020-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. 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 b17058cb3a..4a644c744b 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-2023 the original author or authors. + * Copyright 2020-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. 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 5da58a3468..b150a16a72 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-2023 the original author or authors. + * Copyright 2019-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. 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 9223dec0d6..f6401d6ee5 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-2023 the original author or authors. + * Copyright 2018-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. 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 c70d6e8ad5..5a384bb838 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-2023 the original author or authors. + * Copyright 2015-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. 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 4689be3e13..c0ca6e6f8d 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-2023 the original author or authors. + * Copyright 2019-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. 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 575c00caab..068c0ea716 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-2023 the original author or authors. + * Copyright 2021-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. 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 7db1865834..32dc8dc89b 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 the original author or authors. + * Copyright 2023-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. diff --git a/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java b/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java index b0e613d491..d9fbe94d1c 100644 --- a/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/util/RedisAssertionsUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * 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. 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 6c82dba2e2..eb89fb123f 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-2023 the original author or authors. + * Copyright 2022-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. 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 5e21e95db6..ce18d3cfee 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-2023 the original author or authors. + * Copyright 2019-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. 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 623cf58a87..11a6c62164 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-2023 the original author or authors. + * Copyright 2019-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. 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 57e3cf6170..df1535e475 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-2023 the original author or authors. + * Copyright 2019-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. 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 f7ce4346b9..e9a2519208 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-2023 the original author or authors. + * Copyright 2019-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. 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 87dac4fdd9..970d81faca 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-2023 the original author or authors. + * Copyright 2019-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. 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 0fc9e204ce..30af755677 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-2023 the original author or authors. + * Copyright 2019-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. 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 0583b00fcf..9e14277fb4 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-2023 the original author or authors. + * Copyright 2019-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. 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 557562df1a..748ff04a05 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-2023 the original author or authors. + * Copyright 2019-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. 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 65502266f7..9f7f52175f 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-2023 the original author or authors. + * Copyright 2019-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. 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 4d06d41f4b..219c1ace31 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-2023 the original author or authors. + * Copyright 2022-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.