I have a class which has many simple attributes (type is int
,String
,...). It also has an attribute which is an instance of another class of mine. Now I want to send the object via a Redis pub/sub channel. To do this I serialize it with the GenericJackson2JsonRedisSerializer
. As both classes have their own repository I don't want to embed the object every time but instead only send the ID. I thought that this should be possible by adding the org.springframework.data.annotation.Reference
annotation to the field.
Unfortunately this didn't work, instead it just embeds the object. Is there anything I did wrong? What do I have to do to just get the object's ID in the serialized version?
Thank you for your help!