fix weird prefixes keys when use RedisUtils.scan

pull/737/head
Aborn Jiang 2022-04-21 22:05:28 +08:00
parent f78adec4ec
commit a1a70f82e2
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.*;
@ -41,6 +42,9 @@ public class RedisUtils {
public RedisUtils(RedisTemplate<Object, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
this.redisTemplate.setHashKeySerializer(new StringRedisSerializer());
this.redisTemplate.setKeySerializer(new StringRedisSerializer());
this.redisTemplate.setStringSerializer(new StringRedisSerializer());
}
/**