Java 如果与页面一起使用,Spring数据REST查询将忽略大小选项

Java 如果与页面一起使用,Spring数据REST查询将忽略大小选项,java,spring-boot,spring-data-jpa,Java,Spring Boot,Spring Data Jpa,我在SpringDataREST应用程序中看到了奇怪的行为,当URL的查询部分中存在任何其他内容时,页面大小似乎被忽略。 我的应用程序是SpringBoot2.2.0,JPA存储库实现了JpaRepository。 当我不使用任何页面参数时,输出为: curl http:/localhost:8081/inventory/ ..... "page" : { "size" : 20, "totalElements" : 27422, "totalPages" : 1372, "number" :

我在SpringDataREST应用程序中看到了奇怪的行为,当URL的查询部分中存在任何其他内容时,页面大小似乎被忽略。 我的应用程序是SpringBoot2.2.0,JPA存储库实现了JpaRepository。 当我不使用任何页面参数时,输出为:

 curl http:/localhost:8081/inventory/
.....
"page" : {
"size" : 20,
"totalElements" : 27422,
"totalPages" : 1372,
"number" : 0
}
当我只指定页面大小时,它会起作用:

curl http:/localhost:8081/inventory/?size=5
...
"page" : {
"size" : 5,
"totalElements" : 27422,
"totalPages" : 5485,
"number" : 0
}
但是,当我结合页码指定页面大小时,该大小将被忽略:

curl http:/localhost:8081/inventory/?page=1&size=5
...
"page" : {
"size" : 20,
"totalElements" : 27422,
"totalPages" : 1372,
"number" : 1
}
我还尝试将页面大小与排序一起使用,但也被忽略了。什么会导致这种行为?查询似乎正常,因为响应也在使用它:

"next" : {
  "href" : "http://localhost:8081/inventory?page=2&size=20"
},

您可以尝试回滚到旧版本吗?听起来可能是个bug。@AlanHay又回到了Spring Boot版本1.9,然后又回到了1.5。仍然看到相同的问题您是如何使用Pageable的代码的?添加一些代码,就像我一直使用的一样。一切都是默认的:Repository:(@)RepositoryRestResource(collectionResourceRel=“inventory”,path=“inventory”)公共界面InventoryRepository扩展了JpaRepository{List findByBrand(@Param(“brand”)String brand);}实体:(@)数据(@)实体(@)表(name=“inventory”)公共类清单实现java.io.Serializable{private static final long serialVersionUID=-6062508910146574743L;(@)PostLoad private void PostLoad(){。。。。