The project encountered this error, and spring MVC has this vulnerability.
Org.springframework.beans.InvalidPropertyException:Invalid Property'detail[256]'of beansclass[Com.suning.asvp.mer.entity.InviteCooperationInfo]: Index of outof boundsinchProperty Path'detail[256]'; Nested exception isJava.lang.IndexOutOfBoundsException:Index: the, Size: theAt Org.springframework.beans.BeanWrapperImpl.getPropertyValue (Beanwrapperimpl.java:833) ~[spring-beans-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper (Beanwrapperimpl.java:576) ~[spring-beans-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath (Beanwrapperimpl.java:553) ~[spring-beans-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.beans.BeanWrapperImpl.setPropertyValue (Beanwrapperimpl.java:914) ~[spring-beans-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.beans.AbstractPropertyAccessor.setPropertyValues (Abstractpropertyaccessor.java: the) ~[spring-beans-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.validation.DataBinder.applyPropertyValues (Databinder.java:692) ~[spring-context-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.validation.DataBinder.doBind (Databinder.java:588) ~[spring-context-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.web.bind.WebDataBinder.doBind (Webdatabinder.java:191) ~[spring-web-3.1.2. Release.jar:3.1.2. RELEASE] at Org.springframework.web.bind.ServletRequestDataBinder.bind (Servletrequestdatabinder.java: the) ~[spring-web-3.1.2. Release.jar:3.1.2. RELEASE]
Solution, override the Springmvc restriction array method in action:
@InitBinder public void Initbinder (Webdatabinder binder) { // Set the maximum length of list binder.setautogrowcollectionlimit (10000 ); }
This code I found in the project in the resolution of the framework defects in the baseaction has already rewritten this method, in the other action is inherited baseaction, in the development environment testing is not a problem, but in the test environment is not effective, and finally think of two solutions , 1. Directly in their action to rewrite the above method 2. Convert arrays into JSON strings at the foreground, To the background to convert the JSON string into a set scheme one: In fact, the above code is written in Baseaction in order to do not have to rewrite in the other action, but in the test environment does not take effect, very depressed, only this looks like the Scheme II: Json.stringifier ( MyObject); But to the background is an error, should be the existence of special characters scheme three: the development environment can be, test environment can not, will be other problems, so let the deployment of personnel to clear the deployment package cache, but still useless, may be the two environment differences it is finally solved with a solution, because the time is tight, the project is fast on the line, And if you change to a JSON string, the change point is more, and finally decided to use the scheme before the problem is not known, the work is a learning process
Original address: 50839218
SPRINGMVC cannot exceed 256 values when submitting an array (GO)