赞
踩
用实体接参数时,属性类型是Double,前端传NaN会报错,做了简单处理,记录一下,当然前端不传NaN就更好了…
package cn.edu.oa.jsonSerializer; import cn.micro.framework.exception.BusinessException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.lang.reflect.Field; public class NaNDeserializer extends JsonDeserializer { @Override public Object deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { try { if (jsonParser != null && StringUtils.isNotEmpty(jsonParser.getText())) { if (jsonParser.getText().equals("NaN")) { return null; } else { String curr
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。