json无视注解类型反序列化

// 注解格式的json
@JsonProperty("sv_cust_idno")
private String svCustIdno;

@JsonProperty("joint_cust_idno")
private String jointCustIdno;

// 在不删除有用注解的情况下 无视注解进行反序列生成指定对象
org.codehaus.jackson.map.ObjectMapper mapper = new org.codehaus.jackson.map.ObjectMapper();
mapper.configure(Feature.USE_ANNOTATIONS,false);
BcmConstants.ReqTransCode repTrans = BcmConstants.ReqTransCode.getRepTrans(tradeCode);

BocomRequest request=null;
BizContent bizContent= (BizContent) mapper.readValue(postDataStr, repTrans.getClazz());
request= (BocomRequest) Class.forName(repTrans.getClassName()).newInstance();
request.setBizContent(bizContent);
request.setServiceUrl(redirectUrl);

原文地址:https://www.cnblogs.com/caichaoxiang919/p/14628591.html