springMVC接收值list时,超过256出现IndexOutOfBoundsException

原因

DataBinder类,接收参数中默认为256

public class DataBinder implements PropertyEditorRegistry, TypeConverter {

    /** Default object name used for binding: "target". */
    public static final String DEFAULT_OBJECT_NAME = "target";

    /** Default limit for array and collection growing: 256. */
    public static final int DEFAULT_AUTO_GROW_COLLECTION_LIMIT = 256;

解决方式

在需要的controller中加入如下方法

 @InitBinder  
    protected void initBinder(WebDataBinder binder) {  
        binder.setAutoGrowNestedPaths(true);  
        binder.setAutoGrowCollectionLimit(1024);  
    } 
原文地址:https://www.cnblogs.com/Crush123/p/14367023.html