DATAREST-699 - Fixed pageable parameters showing up as is in search resource links on Java 8.

We now explicitly drop parameters of type Pageable and Sort from being exposed as search resource parameters as they're added via the UriComponentsContributors anyway. This prevents "pageable" from showing up as parameter on Java 8 code compiled with -parameters. The latter adds naming information for the Pageable parameter and caused it showing up as is despite the fact that the UriComponentsContributor for Pageables exposes a dedicated syntax.
This commit is contained in:
Oliver Gierke
2015-11-06 16:31:43 +01:00
parent 1f133fbcd4
commit 5fa89a9c98
2 changed files with 23 additions and 4 deletions

View File

@@ -135,6 +135,18 @@ public class RepositoryMethodResourceMappingUnitTests {
assertThat(mapping.getReturnedDomainType(), is(equalTo((Class) Person.class)));
}
/**
* @see DATAREST-699
*/
@Test
public void doesNotIncludePageableAsParameter() throws Exception {
Method method = PersonRepository.class.getMethod("findByLastname", String.class, Pageable.class);
RepositoryMethodResourceMapping mapping = getMappingFor(method);
assertThat(mapping.getParametersMetadata().getParameterNames(), not(hasItem("pageable")));
}
private RepositoryMethodResourceMapping getMappingFor(Method method) {
return new RepositoryMethodResourceMapping(method, resourceMapping, metadata);
}
@@ -157,5 +169,8 @@ public class RepositoryMethodResourceMappingUnitTests {
Page<Person> findByEmailAddress(String email, Sort pageable);
int countByLastname(String lastname);
// Simulate pageable detected as name on Java 8
Page<Person> findByLastname(@Param("lastname") String lastname, @Param("pageable") Pageable pageable);
}
}