@ Bean @ ConditionalOnClass ( name = "org.springframework.data.redis.connection.RedisConnectionFactory" ) public RedisTemplate < String , Object > functionDomainRedisTemplate ( RedisConnectionFactory redisConnectionFactory ) { JdkSerializationRedisSerializer serializationRedisSerializer = new JdkSerializationRedisSerializer ( ) ; StringRedisSerializer stringRedisSerializer = new StringRedisSerializer ( ) ; RedisTemplate < String , Object > redisTemplate = new RedisTemplate <> ( ) ; redisTemplate . setKeySerializer ( stringRedisSerializer ) ; redisTemplate . setHashKeySerializer ( stringRedisSerializer ) ; redisTemplate . setHashValueSerializer ( serializationRedisSerializer ) ; redisTemplate . setValueSerializer ( serializationRedisSerializer ) ; redisTemplate . setConnectionFactory ( redisConnectionFactory ) ; return redisTemplate ; }
default configuration redis template when have RedisConnectionFactory