така,
@Bean
public RedisTemplate<String, Object> getRedisTemplate() {
RedisTemplate<String, Object> template = new RedisTemplate<>();
Jackson2JsonRedisSerializer jrs = new Jackson2JsonRedisSerializer(String.class);
template.setKeySerializer(jrs);
template.setConnectionFactory(jedisConnectionFactory());
return template;
}
и предлагам да прочетете този документ https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#redis:template