原因是DataBinder 中默认限制了list最大只能增长到256。
private int autoGrowCollectionLimit = DEFAULT_AUTO_GROW_COLLECTION_LIMIT;
解决方案:
1)在BaseController添加InitBinder方法,其余继承BaseController
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setAutoGrowCollectionLimit(Integer.MAX_VALUE);
}
2)增加一个WebBindingInitializer类,并在xml中配置。
public class DataBindingInitializer implements WebBindingInitializer {
@Override
public void initBinder(WebDataBinder binde) {
binder.setAutoGrowCollectionLimit(Integer.MAX_VALUE);
}
}
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="webBindingInitializer">
<bean class="xxx.DataBindingInitializer"/>
</property>
</bean>