顯示具有 Index of out of bounds in property path 標籤的文章。 顯示所有文章
顯示具有 Index of out of bounds in property path 標籤的文章。 顯示所有文章

2016年11月16日 星期三

Spring Bean List max size (Spring AutoPopulatingList)


在使用Spring的時候會把資料封裝在Model(Bean)中使用,有時候資料傳輸用的Model(Bean)的屬性有List類型的資料時,資料數量預設是256筆。(BeanWrapperImpl#autoGrowCollectionLimit)

但有時候需要回傳的資料超過此限制時,就需要在Controller中定義調整,可透過以下方式將上限增加。

@InitBinderpublic void initListBinder(WebDataBinder binder) {
    binder.setAutoGrowCollectionLimit(5000);}

最近開發時碰到此一問題,做個紀錄。