java在springwebservices中实现标记接口

92vpleto  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(178)

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

public interface TryMarker {
}

具有所有getter、setter和注解的bean 1

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

具有所有getter、setter和注解的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"])

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题