3
问题描述
1.2.61版本使用valueFilter抛出NoSuchMethodError,1.2.60版本正常。我不太确定是我使用的姿势不对,还是bug
异常信息Caused by: java.lang.NoSuchMethodError: com.alibaba.fastjson.serializer.JavaBeanSerializer.processValue(Lcom/alibaba/fastjson/serializer/JSONSerializer;Lcom/alibaba/fastjson/serializer/BeanContext;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;Ljava/lang/Integer;
at com.alibaba.fastjson.serializer.ASMSerializer_1_QueryRepayOrderReq.writeNormal(Unknown Source)
at com.alibaba.fastjson.serializer.ASMSerializer_1_QueryRepayOrderReq.write(Unknown Source)
at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:285)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:745)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:679)
...
抛出异常的代码
JSON.toJSONString(req, (ValueFilter) (object, name, value) -> {
if (value instanceof BigDecimal) {
return ((BigDecimal) value).stripTrailingZeros();
}
return value;
});
fastjson依赖