1
votes

I want to customize / configure the serialization policy of spring-data-mongodb (version 1.1.1.RELEASE) without using annotations (like @Id, @Document, @Field) because I do not have access to the domain classes.

Is this possible? If yes, what is the most efficient way to do this?

2

2 Answers

3
votes

In order to customize class serialization as far as I know the only thing you can do is to define custom converters for each class which is described in reference

0
votes

Keep in mind to have a Read- and a WriteConverter for each of your domain classes. Missing the WriteConverter might lead to unexpected content in MongoDB which is not readable by your custom ReadConverter.

ReadConverter should be annotated with @ReadingConverter and WriteConverter should be annotated with @WritingConverter.