diff --git a/Jenkinsfile b/Jenkinsfile
index 2a26afa638..edc046f282 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -9,7 +9,7 @@ pipeline {
triggers {
pollSCM 'H/10 * * * *'
- upstream(upstreamProjects: "spring-data-keyvalue/main", threshold: hudson.model.Result.SUCCESS)
+ upstream(upstreamProjects: "spring-data-keyvalue/4.0.x", threshold: hudson.model.Result.SUCCESS)
}
options {
diff --git a/ci/pipeline.properties b/ci/pipeline.properties
index bb47db3273..9ce2972a2e 100644
--- a/ci/pipeline.properties
+++ b/ci/pipeline.properties
@@ -18,8 +18,8 @@ docker.redis.8.version=8.2.2
docker.valkey.8.version=8.1.1
# Docker environment settings
-docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
-docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home
+docker.java.inside.basic=-v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000
+docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000
# Credentials
docker.registry=
diff --git a/pom.xml b/pom.xml
index 1662c1df41..30c03f822b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-redis
- 4.0.0
+ 4.0.2-SNAPSHOT
Spring Data Redis
Spring Data module for Redis
@@ -14,12 +14,12 @@
org.springframework.data.build
spring-data-parent
- 4.0.0
+ 4.0.2-SNAPSHOT
- 4.0.0
- 4.0.0
+ 4.0.2-SNAPSHOT
+ 4.0.2-SNAPSHOT
1.11.0
1.4.21
2.11.1
@@ -410,7 +410,19 @@
-
-
+
+ spring-snapshot
+ https://repo.spring.io/snapshot
+
+ true
+
+
+ false
+
+
+
+ spring-milestone
+ https://repo.spring.io/milestone
+
diff --git a/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java
index bb4bd2e5a8..2e04fc004e 100644
--- a/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java
@@ -164,7 +164,7 @@ public T deserialize(byte @Nullable [] bytes) throws SerializationException {
* @return the java type
*/
protected JavaType getJavaType(Class> clazz) {
- return TypeFactory.unsafeSimpleType(clazz);
+ return TypeFactory.createDefaultInstance().constructType(clazz);
}
}
diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt
index 9e7c59b0f9..3a15f3355d 100644
--- a/src/main/resources/notice.txt
+++ b/src/main/resources/notice.txt
@@ -1,4 +1,4 @@
-Spring Data Redis 4.0 GA (2025.1.0)
+Spring Data Redis 4.0.1 (2025.1.1)
Copyright (c) [2010-2019] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -16,3 +16,4 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
+
diff --git a/src/test/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializerTests.java b/src/test/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializerTests.java
new file mode 100644
index 0000000000..04e3b762f3
--- /dev/null
+++ b/src/test/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializerTests.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2014-2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.serializer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+
+import tools.jackson.databind.json.JsonMapper;
+import tools.jackson.databind.type.TypeFactory;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.UUID;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.data.redis.Person;
+import org.springframework.data.redis.PersonObjectFactory;
+
+/**
+ * Unit tests for {@link JacksonJsonRedisSerializer}.
+ *
+ * @author Thomas Darimont
+ * @author Christoph Strobl
+ * @author Mark Paluch
+ * @author Chris Bono
+ */
+class JacksonJsonRedisSerializerTests {
+
+ private JacksonJsonRedisSerializer serializer = new JacksonJsonRedisSerializer<>(Person.class);
+
+ @Test // DATAREDIS-241
+ void testJacksonJsonSerializerShouldReturnEmptyByteArrayWhenSerializingNull() {
+ assertThat(serializer.serialize(null)).isEqualTo(new byte[0]);
+ }
+
+ @Test // DTATREDIS-241
+ void testJacksonJsonSerializerShouldReturnNullWhenDerserializingEmptyByteArray() {
+ assertThat(serializer.deserialize(new byte[0])).isNull();
+ }
+
+ @Test // DTATREDIS-241
+ void testJacksonJsonSerializerShouldThrowExceptionWhenDeserializingInvalidByteArray() {
+
+ Person person = new PersonObjectFactory().instance();
+ byte[] serializedValue = serializer.serialize(person);
+ Arrays.sort(serializedValue); // corrupt serialization result
+
+ assertThatExceptionOfType(SerializationException.class).isThrownBy(() -> serializer.deserialize(serializedValue));
+ }
+
+ @Test // GH-2322
+ void shouldConsiderWriter() {
+
+ serializer = new JacksonJsonRedisSerializer<>(new JsonMapper(),
+ TypeFactory.createDefaultInstance().constructType(Person.class), JacksonObjectReader.create(),
+ (mapper, source) -> "foo".getBytes());
+ Person person = new PersonObjectFactory().instance();
+ assertThat(serializer.serialize(person)).isEqualTo("foo".getBytes());
+ }
+
+ @Test // GH-3271
+ void canDeserializeSerializedStandardPojo() {
+
+ // Where "Standard" is POJO w/ private fields w/ getters/setters
+
+ Person person = new PersonObjectFactory().instance();
+ byte[] serializedPerson = JsonMapper.shared().writeValueAsString(person).getBytes();
+
+ Person deserializedPerson = serializer.deserialize(serializedPerson);
+
+ // The bug was that the fields would be null upon deserialization
+ assertThat(deserializedPerson).isEqualTo(person);
+ }
+
+ @Test // GH-3271
+ void canDeserializeSerializedPropertyPojo() {
+
+ // Where "Property" is POJO w/ public fields and no getters/setters
+
+ JacksonJsonRedisSerializer redisSerializer = new JacksonJsonRedisSerializer<>(JsonMapper.shared(), SessionTokenPropertyPojo.class);
+
+ SessionTokenPropertyPojo sessionToken = new SessionTokenPropertyPojo(UUID.randomUUID().toString());
+ byte[] serializedSessionToken = redisSerializer.serialize(sessionToken);//JsonMapper.shared().writeValueAsString(sessionToken).getBytes();
+
+ SessionTokenPropertyPojo deserializedSessionToken = redisSerializer.deserialize(serializedSessionToken);
+
+ // The bug was that the fields would be null upon deserialization
+ assertThat(deserializedSessionToken.userUuid).isEqualTo(sessionToken.userUuid);
+ }
+
+ static class SessionTokenPropertyPojo implements Serializable {
+
+ public String userUuid;
+
+ private SessionTokenPropertyPojo() {
+ }
+
+ SessionTokenPropertyPojo(String userUuid) {
+ this();
+ this.userUuid = userUuid;
+ }
+ }
+
+}