Home > Back-end >  pagination implementation without database java
pagination implementation without database java

Time:11-18

I need to implement pagination in Java in SpringBoot application, but application stores data in memory (in HashMap), not in database, so I can't use Spring Data. I didn't find any examples how to do it, all examples only about pagination of data that stores in database when very easy to use spring PagingAndSortingRepositor but it's not my case.
I will be grateful for any help (ideas, code, links to resources).

CodePudding user response:

Have a look at the Spring Data Key Value project. It provides the well-known Spring Data repository abstraction on top of key value pairs and provides a default implementation based on a Map.

You'd simply declare your repository to extend PagingAndSortingRepository and enable map-based repositories using @EnableMapRepositories on some configuration class.

  • Related