使用velocity模板的模板序列化程序

5n0oy7gb  于 2021-06-08  发布在  Redis
关注(0)|答案(0)|浏览(235)

我正试着把 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缓存?
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题