以下代码在jackson-databind和jackson-core 2.8.5上正常运行,但从2.9.5停止工作。我必须使用2.9.5。
@JsonCreator
public InstrumentCombinedJson(
@JsonProperty("referenceList") final List<InstrumentReferenceJson> referenceList,
@JsonProperty("timeseriesList") final List<InstrumentTimeSeriesJson> timeseriesList,
@JsonProperty("_links") final Map<String, String> _links) {
super(_links);
this.referenceList = referenceList;
this.timeseriesList = timeseriesList;
}
@JsonUnwrapped
public List<InstrumentReferenceJson> getReferenceList() {
return referenceList;
}
@JsonUnwrapped
public List<InstrumentTimeSeriesJson> getTimeseriesList() {
return timeseriesList;
}
抛出以下错误:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot define Creator property "referenceList" as `@JsonUnwrapped`: combination not yet supported
at [Source: (StringReader); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1451)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase._findPropertyUnwrapper(BeanDeserializerBase.java:829)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:494)
问题已在github上打开:https://github.com/FasterXML/jackson-module-kotlin/issues/106
任何人都可以通过任何变通办法来帮助我吗?