Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

How to use jackson instead of JdkSerializationRedisSerializer in spring

$
0
0

I'm using redis in one of my java apps and I'm serializing a list of objects to be stored in Redis. However, I noticed that using the RedisTemplate would use the JdkSerializationRedisSerializer. Instead, I'd like to use Jackson to serialize since I believe it is better for speed. How would I go about configuring my RedisTemplate to use Jackson instead?

For clarification, this is how I'm configuring my RedisTemplate:

@Override
protected RedisConfiguration getRedisConfiguration() {
    return redisConfiguration;
}

@Bean
public RedisTemplate<String, Object> getRedisTemplate() {
    RedisTemplate<String, Object> template = new RedisTemplate<>();
    template.setConnectionFactory(jedisConnectionFactory());
    return template;
}

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>