Reputation: 517
I am testing out Spring Boot with Spring Data REST and am having a problem with the pagination feature. Here's the code:
@RepositoryRestResource(path="logEntry", exported=true)
public interface LogEntryRepository extends MongoRepository<LogEntry, String>{
@RestResource(path="/username", rel="/username")
Page<LogEntry> findByUsername(@Param("username") String username, Pageable pageable);
@RestResource(path="/sessionId", rel="/sessionId")
Page<LogEntry> findBySessionId(@Param("sessionId") String sessionId, Pageable pageable);
@RestResource(path="/source", rel="/source")
Page<LogEntry> findBySource(@Param("source") String source, Pageable pageable);
}
When I run the endpoint provided by the MongoRepository (/logEntry?size=100
), pagination works fine. If I try to hit any of my search endpoints and try to invoke pagination (for example: /logEntry/search/source?source=1&size=100
), it ignores the pagination and always gives me 20 back.
Can anyone tell me how to either
Upvotes: 2
Views: 1261
Reputation: 1729
To increase the default page size you can specify spring.data.rest.default-page-size
property from application.properties
, e.g:
spring.data.rest.default-page-size=100
Upvotes: 0
Reputation: 83131
Sounds like you're running into a variant of this ticket. It already has been resolved in the master and bugfix branch and is scheduled for the upcoming releases. Wouldn't mind if you give the snapshots (2.2.1.BUILD-SNAPSHOT and 2.3.0.BUILD-SNAPSHOT) a try. If you see this working, perfect. If not, feel free to raise an issue containing a tiny sample (a test case preferably) that reproduces the error.
Upvotes: 1