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

  Public Interface UserRepositoryCustom {Public list & lt; Users & gt; GetByKidsAge (@Param ("age") int age); }   

UserRepositoryImpl.java

  The public class uses UserRepositoryImpl UserRepositoryCustom {@Override public list & lt; Users & gt; GetByKidsAge (int age) {return / * display query * /; }}   

UserRepository.java @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); }

This is by design as soon as you implement a repository method manually Let's start, we can not know that GET or POST is the correct HTTP method whether the execution is idempotent how you implement it. / p>

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.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -