Class JdkSerializationRedisSerializer

java.lang.Object
org.springframework.data.redis.serializer.JdkSerializationRedisSerializer
All Implemented Interfaces:
RedisSerializer<Object>

public class JdkSerializationRedisSerializer extends Object implements RedisSerializer<Object>
Java Serialization Redis serializer. Delegates to the default (Java based) serializer and DefaultDeserializer. This serializer can be constructed with either custom ClassLoader or own converters.
Author:
Mark Pollack, Costin Leau, Mark Paluch, Christoph Strobl
  • Constructor Details

    • JdkSerializationRedisSerializer

      public JdkSerializationRedisSerializer()
      Creates a new JdkSerializationRedisSerializer using the default class loader.
    • JdkSerializationRedisSerializer

      public JdkSerializationRedisSerializer(@Nullable ClassLoader classLoader)
      Parameters:
      classLoader - the ClassLoader to use for deserialization. Can be null.
      Since:
      1.7
    • JdkSerializationRedisSerializer

      public JdkSerializationRedisSerializer(org.springframework.core.convert.converter.Converter<Object,byte[]> serializer, org.springframework.core.convert.converter.Converter<byte[],Object> deserializer)
      Creates a new JdkSerializationRedisSerializer using a converters to serialize and deserialize objects.
      Parameters:
      serializer - must not be null
      deserializer - must not be null
      Since:
      1.7
  • Method Details

    • serialize

      public byte[] serialize(@Nullable Object value)
      Description copied from interface: RedisSerializer
      Serialize the given object to binary data.
      Specified by:
      serialize in interface RedisSerializer<Object>
      Parameters:
      value - object to serialize. Can be null.
      Returns:
      the equivalent binary data. Can be null.
    • deserialize

      public Object deserialize(@Nullable byte[] bytes)
      Description copied from interface: RedisSerializer
      Deserialize an object from the given binary data.
      Specified by:
      deserialize in interface RedisSerializer<Object>
      Parameters:
      bytes - object binary representation. Can be null.
      Returns:
      the equivalent object instance. Can be null.