Open
Description
Réda Housni Alaoui opened DATACMNS-1752 and commented
We use:
- Spring Data Commons 2.3.0
- Spring Data JPA 2.3.0
- Spring HATEOAS 1.1.0
HateoasPageableHandlerMethodArgumentResolver
is registered in the Spring context.
Given the following controller:
@Controller
@RequestMapping("/")
public static class MyController {
private final WebMvcLinkBuilderFactory webMvcLinkBuilderFactory;
public MyController(WebMvcLinkBuilderFactory webMvcLinkBuilderFactory) {
this.webMvcLinkBuilderFactory = webMvcLinkBuilderFactory;
}
@GetMapping
public ResponseEntity<?> links() {
return ResponseEntity.ok(
new RepresentationModel<>(
Collections.singletonList(
webMvcLinkBuilderFactory
.linkTo(methodOn(MyController.class).pageable(null))
.withRel("pageable"))));
}
@GetMapping("/pageable")
public ResponseEntity<?> pageable(Pageable pageable) {
return ResponseEntity.noContent().build();
}
}
Querying /
with accept: application/hal+json
produces:
{
"_links": {
"pageable": {
"href": "http://localhost/pageable"
}
}
}
We were expecting the link to be templated with the following optional variables:
- page
- size
The issue on the Spring HATEOAS side is spring-projects/spring-hateoas#706
How to fix that?
Affects: 2.3.1 (Neumann SR1)