I think the problem is when using Spring slices instead of pages. To be able to tell whether there is a next slice spring will add one to the max results. If there is one result more than the size of the current slice it knows that there is a next slice. However, adding 1 to Integer.MAX_VALUE results in a negative number.