-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Spring's REST Template calls this method on MappingJackson2HttpMessageConverter:
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
return (this.objectMapper.canSerialize(clazz) && canWrite(mediaType));
}
However, this fails even though I have set:
converter.getObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
And, in fact, it will serialize the payload just fine, even though it reports that it cannot:
System.out.println(converter.getObjectMapper().canSerialize(EmptyModel.class));
System.out.println(converter.getObjectMapper().writeValueAsString(em));
System.out.println(converter.getObjectMapper().canSerialize(EmptyModel.class));
false
{}
false
Also, related to bug #703 , with version 2.5.1, the result is:
false
{}
true
I haven't had time to trace down what is enabling the actual serialization to go through on writeValueAsString, but I can try to comment later on this.
Metadata
Metadata
Assignees
Labels
No labels