关于java.lang.IllegalArgumentException: class java.text.DecimalFormat declares multiple JSON fields named maximumIntegerDigits异常原因:
以前没问题的业务突然报了这个异常,经排查是因为同事在实体bean中加入了private SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);并添加了get/set方法,导致Gson解析时抛出异常。
去掉sdf的get/set方法即可正常解析。
一篇关于Java中Gson解析遇到IllegalArgumentException的文章,指出问题源于实体bean中私有SimpleDateFormat实例及其get/set方法,移除后解析恢复正常。
8万+

被折叠的 条评论
为什么被折叠?



