java - Spring Data REST : custom query for MongoDB repository -
I'm trying to create a custom query accordingly. But my custom method is not available from the repository's red interface (/ user / search).
(such as the browser is unable to find the local host: 8080 / user / search / GetByKidsAge? Age = 1)
Can anyone figure it out and give me some ideas ? thanks a lot!
Below is my code:
  UserRepositoryCustom.java      UserRepositoryImpl.java      UserRepository.java       This is by design as soon as you implement a repository method manually Let's start, we can not know that   Then how to implement a custom controller and expose those methods by using sufficient HTTP method. He said, there is a way in our tracker to define these approaches in our methods.    
 Public Interface UserRepositoryCustom {Public list & lt; Users & gt; GetByKidsAge (@Param ("age") int age); }    
 The public class uses UserRepositoryImpl UserRepositoryCustom {@Override public list & lt; Users & gt; GetByKidsAge (int age) {return / * display query * /; }}    @RepositoryRestResource (collectionResourceRel = "user", path = "user") Public Interface UserRepository has updated MongoRepository & lt; User, String & gt ;, UserRepositoryCustom {list & lt; User & gt; FindByLastName (@Param ("name") string name); }     GET  or  POST  is the correct HTTP method whether the execution is idempotent how you implement it. / p> 
 
Comments
Post a Comment