bug尝试修复

This commit is contained in:
2025-07-15 16:55:24 +08:00
parent 0aadd61d5b
commit 4f10b93e62

View File

@@ -165,14 +165,15 @@ public class RedisConfig extends CachingConfigurerSupport
@Qualifier("redisSecondConnectionFactory") RedisConnectionFactory redisSecondConnectionFactory) { @Qualifier("redisSecondConnectionFactory") RedisConnectionFactory redisSecondConnectionFactory) {
RedisTemplate<Object, Object> template = new RedisTemplate<>(); RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(redisSecondConnectionFactory); template.setConnectionFactory(redisSecondConnectionFactory);
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer =
new Jackson2JsonRedisSerializer(Object.class); FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
// 使用StringRedisSerializer来序列化和反序列化redis的key值 // 使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer()); template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(jackson2JsonRedisSerializer); template.setValueSerializer(serializer);
// Hash的key也采用StringRedisSerializer的序列化方式 // Hash的key也采用StringRedisSerializer的序列化方式
template.setHashKeySerializer(new StringRedisSerializer()); template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(jackson2JsonRedisSerializer); template.setHashValueSerializer(serializer);
template.afterPropertiesSet(); template.afterPropertiesSet();
return template; return template;