使用SpringMVC或者SpringBoot提交数组时,如果list大小超过256,就会报错。
原因是DataBinder 中默认限制了list最大只能增长到256。
private int autoGrowCollectionLimit = DEFAULT_AUTO_GROW_COLLECTION_LIMIT;
解决方案:
在需要的Action中添加InitBinder方法。
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setAutoGrowCollectionLimit(Integer.MAX_VALUE);
}

1970

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



