Class AllowListJdkSerializationRedisSerializer
java.lang.Object
org.springframework.integration.redis.support.AllowListJdkSerializationRedisSerializer
- All Implemented Interfaces:
RedisSerializer<Object>
public class AllowListJdkSerializationRedisSerializer
extends Object
implements RedisSerializer<Object>
A JDK serialization based
RedisSerializer which deserializes only
classes matching the allowed patterns.
By default, only java.lang, java.util, java.time and Spring messaging
types are allowed, which is enough to deserialize a Message
with standard headers and simple payloads.
Any other types must be allowed via addAllowedPatterns(String...).
Arrays, primitives, String and Number types are always allowed.
- Since:
- 5.5.23
- Author:
- Artem Bilan
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllowedPatterns(String... patterns) Add package/class patterns to the allowed list.@Nullable Objectdeserialize(byte @Nullable [] bytes) byte[]Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RedisSerializer
canSerialize, deserialize, getTargetType
-
Constructor Details
-
AllowListJdkSerializationRedisSerializer
public AllowListJdkSerializationRedisSerializer() -
AllowListJdkSerializationRedisSerializer
-
-
Method Details
-
addAllowedPatterns
Add package/class patterns to the allowed list. A class can be fully qualified, or a wildcard '*' is allowed at the beginning or end of the class name. Examples:com.example.*,*.MyClass.- Parameters:
patterns- the patterns to add.
-
serialize
- Specified by:
serializein interfaceRedisSerializer<Object>- Throws:
SerializationException
-
deserialize
- Specified by:
deserializein interfaceRedisSerializer<Object>- Throws:
SerializationException
-