iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
PagedModel does not paginate an arbitrary custom-repository result or generate navigation links on its own. For Spring HATEOAS page links, have the repository return a correctly populated Spring Data Page<T>, then pass it to PagedResourcesAssembler.toModel(...). First check which PagedModel you imported: Spring Data’s simplified JSON model and Spring HATEOAS’s linked representation are different types for different jobs.
Why PagedModel appears not to work
“PagedModel doesn’t work” can mean several things: the endpoint imports the other class with the same name, the repository returns a list or custom DTO instead of a Spring Data Page, the representation has no page metadata, or the application expects links without invoking the HATEOAS assembler.
These are separate issues. PagedModel is a representation container; it is not a repository paging mechanism. The HATEOAS assembler is the conversion layer that takes a Page and builds a linked response.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Check which PagedModel you mean
Spring Data and Spring HATEOAS both define a type named PagedModel. Check the fully qualified import before changing repository code.
#1 Best Overall
| Type or approach | Input | Output and links | Use it when |
|---|---|---|---|
org.springframework.hateoas.PagedModel with PagedResourcesAssembler |
Spring Data Page<T> |
HATEOAS representation with page navigation links generated from the request or a supplied self link | Clients need hypermedia navigation |
org.springframework.data.web.PagedModel |
Spring Data Page<T> |
Simplified page metadata representation; no navigation links | You need a stable, simplified page JSON envelope |
Manually created HATEOAS PagedModel |
Content, explicit metadata, and optional links | Only the metadata and links you supply | Your application owns and can validate the pagination details |
SlicedResourcesAssembler |
Spring Data Slice<T> |
HATEOAS SlicedModel for slice-oriented navigation |
The query does not need to assert total-page counts |
Spring Data documents the simplified model and its VIA_DTO page-serialization option in its web support reference. Spring HATEOAS documents its PagedModel API as a representation for pageable collection responses.
Make a custom repository return a real Page
Custom query logic is compatible with HATEOAS pagination. The key is for the repository method to return a Spring Data Page<T> whose content, requested page, page size, and total count accurately describe the query. The total must be relevant to the same result set and filtering rules; otherwise the resulting page metadata and navigation links can mislead clients.
Rank #2
A list alone generally cannot tell the framework how many matching elements exist or what the total number of pages should be. Either implement the custom query so it returns a suitable Page, including the appropriate total, or deliberately construct a representation with metadata and links your application can substantiate.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Convert the Page at the controller boundary
Inject PagedResourcesAssembler<T> into the controller and pass it the repository’s page. The documented assembler accepts a Spring Data Page<T> and converts it to a HATEOAS PagedModel; it is not a conversion method for an arbitrary collection or application-specific DTO. Spring Data’s assembler API documents toModel(Page) and overloads for an element assembler and self link.
Rank #3
@GetMapping("/items")
PagedModel<EntityModel<Item>> items(
Pageable pageable,
PagedResourcesAssembler<Item> assembler) {
Page<Item> page = repository.findCustomItems(pageable);
return assembler.toModel(page);
}
This is an illustrative shape, not a tested implementation. Adapt the element representation, repository method, and endpoint link to your application.
Check how pagination links are built
When the assembler has no configured base URI, its API says that toModel(Page) uses the current request URI to build relevant previous and next links. You can use an overload with a custom self link when the pagination links should point to a different base. The assembler’s default behavior points to the controller method where it was invoked.
Rank #4
Generated pagination parameters follow the pageable resolver configuration. If your application changes parameter names or defaults, keep the resolver setup consistent with the links clients will follow. See the Spring Data web support reference for assembler and pageable configuration guidance.
Recommended Free Tools
Choose Page, Slice, or manual metadata deliberately
Use Page when clients need totals
A Page<T> carries page content and total-page information. Return one when the query can provide an accurate total and clients need that metadata or page-number navigation. The HATEOAS PageMetadata API defines size, zero-indexed page number, total elements, and total pages.
Use Slice when total counts are unnecessary
If the query path does not need total counts, Spring Data’s reference describes SlicedResourcesAssembler as the analogous conversion from a Slice<T> to a HATEOAS SlicedModel. This avoids presenting total-page counts as known when the query does not establish them.
Build a HATEOAS PagedModel only when you own its facts
Spring HATEOAS provides PagedModel.of(content, metadata, links). Because content, metadata, and links are explicit inputs, this is an option when your application can calculate and validate them itself—not a shortcut that recovers missing totals from a list. See the PagedModel API for its representation inputs.
Use Spring Data’s simpler envelope only if links are not required
If the goal is stable page metadata in JSON rather than HATEOAS navigation, Spring Data’s org.springframework.data.web.PagedModel can wrap a Page. The reference also documents @EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO) for simplified serialization of returned Page instances. This route does not generate the navigation links provided by the HATEOAS assembler, so choose it only when that matches the client contract.
Free tools Windows power users keep installed
One-click scans. No signup required.
Version compatibility
The cited API documentation is labeled Spring Data Commons 4.1.0 and Spring HATEOAS 3.1.1, accessed October 7, 2026. Your project’s dependency versions are unspecified; confirm that the referenced overloads and configuration options exist in your version before applying version-specific code.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

