I solved this by adding the following static members:
private static JacksonJsonProvider jackson_json_provider = new JacksonJaxbJsonProvider()
.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
private static ObjectMapper object_mapper = jackson_json_provider.locateMapper(
Object.class, MediaType.APPLICATION_JSON_TYPE);
private static Client client = ClientBuilder.newClient().register(jackson_json_provider);
Note that the second declaration is not needed just to configure FAIL_ON_UNKNOWN_PROPERTIES
or FAIL_ON_EMPTY_BEANS
; I use object_mapper
for some other reasons.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…