JavaType javaType = TypeFactory.defaultInstance()
constructParametrizedType(Page.class,Page.class, CustomerDTO.class);
Page<CustomerDTO> list = JsonUtil.om().readValue(res, javaType);
public class JsonUtil {
/**
* 返回mapper,忽略未知参数、使用long解析时间
*
* @return
*/
public static ObjectMapper om() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
mapper.configure(
DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS,
true);
return mapper;
}
}