}
ObjectMapper mapper = new ObjectMapper();
ByteArrayInputStream bais = new ByteArrayInputStream(string.getBytes());
DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();
deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true);
deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true);
deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_CREATORS, true);
deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true);
deserializationConfig.set(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
try {
T payload = mapper.readValue(bais, clazz);
return payload;
} catch (Exception e) {
logger.error("Exception during deserialization of payload bytes: " + string, e);