From b798d001d77db5ef0c751a86554d90472dd23d63 Mon Sep 17 00:00:00 2001 From: "bangsen.yin" <020lilin@gmail.com> Date: Fri, 26 Sep 2014 11:28:25 +0800 Subject: [PATCH] Add missing @Param annotations to CityRepository in Data REST sample Without the @Param annotations, using either of the search URIs would resulted in a 400 response and an error describing the lack of @Param annotation. See gh-1627 --- .../java/sample/data/jpa/service/CityRepository.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java index 281e75977e..4281956641 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java @@ -19,6 +19,7 @@ package sample.data.jpa.service; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import sample.data.jpa.domain.City; @@ -26,9 +27,11 @@ import sample.data.jpa.domain.City; @RepositoryRestResource(collectionResourceRel = "citys", path = "cities") interface CityRepository extends PagingAndSortingRepository { - Page findByNameContainingAndCountryContainingAllIgnoringCase(String name, - String country, Pageable pageable); + Page findByNameContainingAndCountryContainingAllIgnoringCase( + @Param("name") String name, @Param("country") String country, + Pageable pageable); - City findByNameAndCountryAllIgnoringCase(String name, String country); + City findByNameAndCountryAllIgnoringCase(@Param("name") String name, + @Param("country") String country); }