Skip to content

Commit b798d00

Browse files
ivan-yinwilkinsona
authored andcommitted
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
1 parent d0990c0 commit b798d00

File tree

1 file changed

+6
-3
lines changed
  • spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service

1 file changed

+6
-3
lines changed

spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@
1919
import org.springframework.data.domain.Page;
2020
import org.springframework.data.domain.Pageable;
2121
import org.springframework.data.repository.PagingAndSortingRepository;
22+
import org.springframework.data.repository.query.Param;
2223
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
2324

2425
import sample.data.jpa.domain.City;
2526

2627
@RepositoryRestResource(collectionResourceRel = "citys", path = "cities")
2728
interface CityRepository extends PagingAndSortingRepository<City, Long> {
2829

29-
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name,
30-
String country, Pageable pageable);
30+
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
31+
@Param("name") String name, @Param("country") String country,
32+
Pageable pageable);
3133

32-
City findByNameAndCountryAllIgnoringCase(String name, String country);
34+
City findByNameAndCountryAllIgnoringCase(@Param("name") String name,
35+
@Param("country") String country);
3336

3437
}

0 commit comments

Comments
 (0)