redis / redis-om-spring

Spring Data Redis extensions for better search, documents models, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom converters for Enum to String not working

irinaalbu89 opened this issue · comments

I want to create a custom converter for an enum we have, in order to serialize/deserialize from one of its properties. I created two Converter classes, for reading and writing, and registered a RedisOMCustomConversions Bean, but it doesn't work, my converters don't get registered. I looked in the redis-om-spring code, and I saw this method in the RedisOmCustomCoversions class:

public RedisOMCustomConversions(List<?> converters) {
super(omConverters);
}

It seems the converters I provide as the parameter in the constructor don't get registered, nothing is done with them. I think this needs to be fixed. Please tell me if there is another way to achieve what I need (custom serialization/deserialization for my enums)
I am using Document entities (to write jsons in the Redis DB)

The regular converters are for Hashes (inherited from Spring Data Redis), for JSON we use GSON but I see you discovered that already.