You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to save a recursive object in Redis. For example:
public Test(){ Test test; }
I noticed that the codec implementation is Kryo5Codec, which is set with kryo.setReferences(false); when initializing the Kryo object:
protected Kryo createKryo(ClassLoader classLoader) { Kryo kryo = new Kryo(); if (classLoader != null) { kryo.setClassLoader(classLoader); } kryo.setInstantiatorStrategy(new SimpleInstantiatorStrategy()); kryo.setRegistrationRequired(false); kryo.setReferences(false); kryo.addDefaultSerializer(Throwable.class, new JavaSerializer()); kryo.addDefaultSerializer(UUID.class, new DefaultSerializers.UUIDSerializer()); kryo.addDefaultSerializer(URI.class, new DefaultSerializers.URISerializer()); kryo.addDefaultSerializer(Pattern.class, new DefaultSerializers.PatternSerializer()); return kryo; }
I'm trying to save a recursive object in Redis. For example:
public Test(){ Test test; }
I noticed that the codec implementation is Kryo5Codec, which is set with kryo.setReferences(false); when initializing the Kryo object:
protected Kryo createKryo(ClassLoader classLoader) { Kryo kryo = new Kryo(); if (classLoader != null) { kryo.setClassLoader(classLoader); } kryo.setInstantiatorStrategy(new SimpleInstantiatorStrategy()); kryo.setRegistrationRequired(false); kryo.setReferences(false); kryo.addDefaultSerializer(Throwable.class, new JavaSerializer()); kryo.addDefaultSerializer(UUID.class, new DefaultSerializers.UUIDSerializer()); kryo.addDefaultSerializer(URI.class, new DefaultSerializers.URISerializer()); kryo.addDefaultSerializer(Pattern.class, new DefaultSerializers.PatternSerializer()); return kryo; }
To solve this, I overrode it like so:
}`
and set the Redisson config with:
config.setCodec(new CustomKryoCodec());
Is there native support in Redisson for working with recursive objects?
Redisson version: 3.23.2
The text was updated successfully, but these errors were encountered: