I am trying to create a custom query from the Spring guide : Accessing MongoDB Data with REST according to the Reference 4.4 Custom Implementations. But my custom method is not available from the repository's REST interface (/user/search).
(e.g. Browser is unable to find localhost:8080/user/search/GetByKidsAge?age=1)
Could someone help me to figured this out and give me some suggestions? Thanks a lot !!
Below is my code:
UserRepositoryCustom.java
public interface UserRepositoryCustom {
public List<User> GetByKidsAge(@Param("age") int age);
}
UserRepositoryImpl.java
public class UserRepositoryImpl implements UserRepositoryCustom {
@Override
public List<User> GetByKidsAge(int age) {
return /*perform query*/;
}
}
UserRepository.java
@RepositoryRestResource(collectionResourceRel = "user", path = "user")
public interface UserRepository extends MongoRepository<User, String>, UserRepositoryCustom {
List<User> findByLastName(@Param("name") String name);
}