[Spring Error] Invalid list index 256


Using List<Integer> ids to receive a form parameter of HTTP request. The size of the parameter ids is over 255.

Error Info

org.springframework.beans.InvalidPropertyException: Invalid property 'ids[256]' of bean class [com.fantasi.manage.console.web.modules.recovery.dto.RecoveryGroupDto]: Invalid list index in property path 'ids[256]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 256, Size: 256. 


To override init Binder method and configure the limit size which needs so that you can pass those many objects to your controller classes.

public class MyController {

public void initBinder(WebDataBinder dataBinder) {


@InitBinder plays the role to identify the methods which initialize the WebDataBinder.

WebDataBinder is a DataBinder that binds request parameter to JavaBean objects.


By default spring only maps only 255 objects to the java bean. Spring developers has done this to prevent OutOfMemory problem.


[1] Spring initBinder for Handling Large List of Java Objects