rmuller
rmuller

Reputation: 12859

Customization of serialization policy spring-data-mongodb without using annotations

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?

Upvotes: 2

Views: 3140

Answers (2)

flexguse
flexguse

Reputation: 479

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.

Upvotes: 0

Maciej Walkowiak
Maciej Walkowiak

Reputation: 12932

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

Upvotes: 3

Related Questions