spring-projects / spring-projects/spring-hateoas
PageableArgumentResolver unable to apply PageableDefaults.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a legacy Spring MVC App, for which I wrote this controller: Sorry if this is the wrong forum for this.
@Controller
@RequestMapping("/report")
public class ReportResource
{
@Inject private ReportService service;
@RequestMapping(method = RequestMethod.GET, produces = "application/hal+json" )
ResponseEntity getReport(@PageableDefault(size = 100, page = 0) Pageable pageable)
{
System.out.println("size = " + pageable.getPageSize());
return new ResponseEntity<>(HttpStatus.OK);
}
}
when I launch my server I can see in the debugger that the method:
getDefaultFromAnnotationOrFallback() at the PageableArgumentResolver
returns false while evaluating if (annotation instanceof PageableDefaults)
because the annotation handler points to a Proxy class instead of PageableDefaults.
what am I doing wrong?
thanks in advance!
<import resource="classpath:META-INF/spring/app-context.xml"/>
<context:component-scan base-package="com.precor.reportingApi.rest"/>
<bean class="org.springframework.data.web.config.HateoasAwareSpringDataWebConfiguration" />
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="org.springframework.data.web.PageableArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
</beans>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PageableArgumentResolver#getDefaultFromAnnotationOrFallback and the controller's @PageableDefault parameter. Then inspect the mvc:argument-resolvers configuration and the annotation type observed by the resolver. Done means determining why the configured resolver receives a proxy rather than the expected pageable-default annotation and documenting or correcting the supported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100