0

我想实现 Marker 接口,有两个子类,类似于工厂模式。

public interface TryMarker {
}

具有所有 getter & setter & annotations 的 Bean 1

public class AadharLogs implements TryMarker{
    private AadharRequest req;
    private AadharResponse res;
}

具有所有 getter & setter & annotations 的 Bean 2

public class PanLogs implements TryMarker{
    private List<PanRequest> req;
    private PanResponse res;
}

当我传递这个 JSON 时,我得到了错误

SEVERE: Servlet.service() for servlet [ds] in context with path [/automation] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com.awcsoftware.dto.ekyc.TryMarker]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.awcsoftware.dto.ekyc.TryMarker` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (PushbackInputStream); line: 10, column: 15] (through reference chain: com.awcsoftware.dto.WorkItem["kycValidationLogs"]->java.lang.Object[][0]->com.awcsoftware.dto.ekyc.KYCValidationLogs["logs"])] with root cause
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.awcsoftware.dto.ekyc.TryMarker` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (PushbackInputStream); line: 10, column: 15] (through reference chain: com.awcsoftware.dto.WorkItem["kycValidationLogs"]->java.lang.Object[][0]->com.awcsoftware.dto.ekyc.KYCValidationLogs["logs"])
4

0 回答 0