I noticed that since spring-data-commons release 2.0.12 (if not the earlier 2.x versions), using the method
eventually culminates in calling
, which throws an UnsupportedOperationException. I noticed this while upgrading our project from Spring Boot 1.4 (with spring-data-commons-1.12.2) to Spring Boot 2.0 (with spring-data-commons-2.0.12).
I suspect the reason behind this is that in spring-data-commons-2.x (as opposed to 1.x), the method addPaginationLinks() in class PagedResourcesAssembler was modified as follows:
spring-data-commons-2.0.12 (inside method addPaginationLinks):
spring-data-commons-1.12.2 (inside method addPaginationLinks):
As you can see, the method createLink is now being passed a page.getPageable(), as opposed to null, which down the line gets passed to HateoasPageableHandlerMethodArgumentResolver#enhance(), which throws an UnsupportedOperationException when pageable.getPageNumber(); is called inside it. Previously, a null was being passed to this enhance() method, which resulted in an early return due to this if condition:
I am not very familiar with the spring-data-commons library, but if someone could shed some light on this, I would be grateful. Thanks.
FYI, here are all the versions of the different libraries I am using: