Skip to content

Commit

Permalink
Reuse StringRedisSerializer instance
Browse files Browse the repository at this point in the history
  • Loading branch information
quaff authored Apr 18, 2022
1 parent ce2e644 commit cf0d9fc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.session.config.annotation.web.http.EnableSpringHttpSession;
import org.springframework.session.data.redis.RedisSessionRepository;

Expand All @@ -53,8 +53,8 @@ public SessionConfig(SessionProperties sessionProperties, RedisSessionProperties
public RedisOperations<String, Object> sessionRedisOperations() {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(this.redisConnectionFactory);
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setKeySerializer(RedisSerializer.string());
redisTemplate.setHashKeySerializer(RedisSerializer.string());
return redisTemplate;
}

Expand Down

0 comments on commit cf0d9fc

Please # to comment.