List of usage examples for org.springframework.data.redis.core RedisTemplate setKeySerializer
public void setKeySerializer(RedisSerializer<?> serializer)
From source file:org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration.java
private RedisTemplate<Object, Object> createRedisTemplate() { RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.setHashKeySerializer(new StringRedisSerializer()); if (this.defaultRedisSerializer != null) { redisTemplate.setDefaultSerializer(this.defaultRedisSerializer); }// w w w . j av a 2 s . com redisTemplate.setConnectionFactory(this.redisConnectionFactory); redisTemplate.setBeanClassLoader(this.classLoader); redisTemplate.afterPropertiesSet(); return redisTemplate; }
From source file:org.springframework.session.data.redis.RedisOperationsSessionRepository.java
private static RedisTemplate<Object, Object> createDefaultTemplate(RedisConnectionFactory connectionFactory) { Assert.notNull(connectionFactory, "connectionFactory cannot be null"); RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>(); template.setKeySerializer(new StringRedisSerializer()); template.setHashKeySerializer(new StringRedisSerializer()); template.setConnectionFactory(connectionFactory); template.afterPropertiesSet();//from ww w . j a v a 2 s .co m return template; }