Example usage for org.springframework.data.redis.core RedisTemplate setBeanClassLoader

List of usage examples for org.springframework.data.redis.core RedisTemplate setBeanClassLoader

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisTemplate setBeanClassLoader.

Prototype

@Override
public void setBeanClassLoader(ClassLoader classLoader) 

Source Link

Document

Set the ClassLoader to be used for the default JdkSerializationRedisSerializer in case no other RedisSerializer is explicitly set as the default one.

Usage

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);
    }/*from  w w  w.j av a 2s.  c  o m*/
    redisTemplate.setConnectionFactory(this.redisConnectionFactory);
    redisTemplate.setBeanClassLoader(this.classLoader);
    redisTemplate.afterPropertiesSet();
    return redisTemplate;
}