从json到java对象的转换失败。更新到杰克逊版本2.9.7后失败。
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include =
JsonTypeInfo.As.PROPERTY, property = "className")
public class DefaultValidator implements Validator {}
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.configure(SerializationFeature.FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS, false);
objectMapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
obj = objectMapper.readValue(jsonBody, clazz);`
UIRowInput {private DefaultValidator rowCommmonValidator;}
以下是例外情况:
未识别的字段“ @class”(类com.fe.core.validator.DefaultValidator),未在[来源:(StringReader)处标记为可忽略(0个已知属性:]);行:1,列:3043](通过参考链:com.ui.request.input.UpdateGraphInputRequest [“ graphInput”]-> com.model.ui.graph.UIGraphInput [“ nodeInputs”]-> java.util.ArrayList [0]-> com.model.ui.graph.item.node.UINodeInput [“ nodeInputs]]-> java.util.ArrayList [0]-> com.model.ui.graph.item.node.UINodeInput [” lineItemInputs“]-> java.util.ArrayList [0]-> com.model.ui.graph.item.lineItem.UILineItemInput [” tabInput“]-> com.model.ui.graph.item.lineItem.matrix.UITabInput [“ rowInputs”]-> java.util.ArrayList [0]-> com.model.ui.graph.item.lineItem.matrix.UIRowInput [“ rowCommmonValidator”]-> com.fe.core.validator.DefaultValidator [“ @class“])
谢谢!