From 6df5389d76df0c16d2ebad75eb1144ae69b9845d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 10 Oct 2023 11:25:22 +0100 Subject: [PATCH] Use RedisSeralizer.java(ClassLoader) factory method Closes gh-37800 --- .../data/redis/RedisReactiveAutoConfiguration.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisReactiveAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisReactiveAutoConfiguration.java index 9f2cb6ee3c..1e1fefe8ef 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisReactiveAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisReactiveAutoConfiguration.java @@ -28,8 +28,8 @@ import org.springframework.core.io.ResourceLoader; import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; import org.springframework.data.redis.core.ReactiveRedisTemplate; import org.springframework.data.redis.core.ReactiveStringRedisTemplate; -import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.RedisSerializer; /** * {@link EnableAutoConfiguration Auto-configuration} for Spring Data's reactive Redis @@ -48,14 +48,13 @@ public class RedisReactiveAutoConfiguration { @ConditionalOnBean(ReactiveRedisConnectionFactory.class) public ReactiveRedisTemplate reactiveRedisTemplate( ReactiveRedisConnectionFactory reactiveRedisConnectionFactory, ResourceLoader resourceLoader) { - JdkSerializationRedisSerializer jdkSerializer = new JdkSerializationRedisSerializer( - resourceLoader.getClassLoader()); + RedisSerializer javaSerializer = RedisSerializer.java(resourceLoader.getClassLoader()); RedisSerializationContext serializationContext = RedisSerializationContext .newSerializationContext() - .key(jdkSerializer) - .value(jdkSerializer) - .hashKey(jdkSerializer) - .hashValue(jdkSerializer) + .key(javaSerializer) + .value(javaSerializer) + .hashKey(javaSerializer) + .hashValue(javaSerializer) .build(); return new ReactiveRedisTemplate<>(reactiveRedisConnectionFactory, serializationContext); }