redis hash值序列化
This commit is contained in:
parent
dbcad992e5
commit
7f2552d018
|
|
@ -40,7 +40,7 @@ public class RedisConfig {
|
|||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new StringRedisSerializer());
|
||||
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
redisTemplate.setConnectionFactory(factory);
|
||||
return redisTemplate;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.czg.service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -31,7 +31,7 @@ public class RedisService {
|
|||
*/
|
||||
public final static long NOT_EXPIRE = -1L;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
public RedisService(RedisTemplate<String, Object> redisTemplate) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue