New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pageable to applicable controllers to prevent issue in PagedResourcesAssembler #1383
Conversation
* The newer version of spring-data-commons unearthed a shortcoming in the handling of PagedResourcesAssembler's. Added Pageable support where necessary * Adjusted the default page size to 2000 (the same as org.springframework.data.web.PageableHandlerMethodArgumentResolver#DEFAULT_MAX_PAGE_SIZE)
A before and after for |
@donovanmuller I haven't been able to reproduce the issue with |
@@ -116,7 +117,8 @@ public AppRegistryController(AppRegistry appRegistry, | |||
} | |||
} | |||
Collections.sort(list); | |||
return pagedResourcesAssembler.toResource(new PageImpl<>(list), assembler); | |||
return pagedResourcesAssembler | |||
.toResource(new PageImpl<>(list, pageable, appRegistry.findAll().size()), assembler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appRegistry.findAll()
can be reused from what we computed above in the same method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix while merging.
@donovanmuller Thank you for the contribution. Merged the PR as 2184068 along with eae98f4 |
Thanks, @donovanmuller and @ilayaperumalg. Unfortunately, this commit has a side effect on Flo's pagination (#1397). We may have to revert the commit and investigate the applicability of PR and it's side effects post 1.2.0. |
Revert PR: #1400 Let's make these changes after 1.2.0.RELEASE |
The root cause of this issue is that As a follow up, I have created this story: #1401 |
So, what version of spring-boot does work? |
so... I am trying to write an implementation of spring-cloud-deployer-spi at version 1.2.0.RELEASE. It is an spring-boot app, so my parent is spring-boot-starter-parent at version "1.4.6.RELEASE", also trried at version "1.5.2.RELEASE". The app boots just fine, but then I am getting this error when trying to use the UI... what version should I set on my pom for the parent or for -spi to get this error to go away? |
Same problem here. Is there any workaround while the fix is being worked on? |
Hi, |
Hi, @kalvarez2, @vijaykalidindi, @SuperMohit. The fix is underway via #1545. Once this is merged (hopefully today), we will update the relevant bits associated with this PR and release it in the upcoming 1.2.2.RELEASE. Thanks for the patience. |
This can be closed as #1545 is merged with the changes from this PR. |
Fixes #1382
If Spring Boot were to be updated to 1.5.3, it would bring in
spring-data-commons:1.13.3.RELEASE
which includes a fix for DATACMNS-1042 (Self link created with pagination request parameters) in spring-projects/spring-data-commons@a8ff4ea. This commit breaks certain controllers using thePagedResourcesAssembler
inspring-cloud-dataflow-server-core
.For example, the following exception will be thrown (using the local server for testing) when requesting http://localhost:9393/apps:
The reason this happens is because a new
PageImpl
, with default values of0
for page and page size, is being shipped to thePagedResourcesAssembler
. This (new) line inPagedResourcesAssembler
creates a newPageRequest
with the passed inPageable
and is where thesize < 1
check blows up becausesize == 0
.So we need to add a
Pageable
param (with sane defaults provided byPageableHandlerMethodArgumentResolver
) to the affected controller methods and use that when building thePageImpl
.Also changed the default page size to
2000
on the REST templates to match DEFAULT_MAX_PAGE_SIZE, since10000
would be converted to2000
anyway.