我正试着把 Template
对象(org.apache.velocity.template)到
RedisTemplate redisTemplate.opsForHash().put("Redis_Cache", objectKey, data);
但有个错误:
Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.apache.velocity.Template
这是我的模板:
@Bean
public RedisTemplate<?, ?> redisTemplate() {
RedisTemplate<?, ?> template = new RedisTemplate<>();
template.setDefaultSerializer(new GenericJackson2JsonRedisSerializer());
template.setConnectionFactory(redisConnectionFactory());
return template;
}
是否可以将velocity对象放入redis缓存?
谢谢
暂无答案!
目前还没有任何答案,快来回答吧!