[java][jersey2-client] Disable coercion of scalars (#6811)

* [java][jersey2-client] Disable coercion of scalars

* Respect the coercion objectmapper setting in deserializers

* Update jackson in maven plugin to get version that has ALLOW_COERCION_OF_SCALARS
This commit is contained in:
Slavek Kabrda
2020-07-23 10:33:15 +02:00
committed by GitHub
parent 3199ddc615
commit 03e8aee8ea
16 changed files with 454 additions and 129 deletions

View File

@@ -21,6 +21,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
public JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);