|
@@ -10,6 +10,8 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
|
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
|
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
|
|
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
|
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
|
|
|
|
@Configuration
|
|
@@ -71,4 +73,18 @@ public class RedisConfig {
|
|
|
// template.setEnableTransactionSupport(true);
|
|
|
return template;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 由于v4场景中心要获取v3的登录用户信息,而v3的jedis使用的是默认的jdk序列化器,所以这里提供了一个特殊的redistemplate,v3废弃后需要删除
|
|
|
+ * @param redisConnectionFactory
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public RedisTemplate<String, Object> redisTemplate2(RedisConnectionFactory redisConnectionFactory) {
|
|
|
+ RedisTemplate template = new RedisTemplate();
|
|
|
+ template.setConnectionFactory(redisConnectionFactory);
|
|
|
+ StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
|
|
+ template.setKeySerializer(stringRedisSerializer);
|
|
|
+ return template;
|
|
|
+ }
|
|
|
}
|