mechero / full-reactive-stack

Full Reactive Stack with Spring Boot (WebFlux), MongoDB and Angular
https://thepracticaldeveloper.com/2020/06/16/full-reactive-stack-1-intro/
328 stars 156 forks source link

Create, update and Delete endpoints #5

Open shapan1 opened 3 years ago

shapan1 commented 3 years ago

Hi, I went through your course on educative.io. I saw how you created the mongo repository and loaded data into the Mongo instance. However, I wanted to know :

  1. how the interface worked without an actual implementation?
  2. How can I create the other Create, update and delete endpoints?
mechero commented 3 years ago

Hi @shapan1,

  1. The interface doesn't need an implementation because it uses Spring Data JPA's Query Methods. In short, this means the name of the method is translated to a query by Spring.
  2. The ReactiveSortingRepository that the code uses extends the ReactiveCrudRepository interface. This one has methods to create, update, and delete entities. You can check the docs here.

If you want to know more about Spring Data and how it integrates with Spring Boot in a microservices architecture, let me recommend you my book Learn Microservices with Spring Boot.

In any case, feel free to ask as many questions as you need 😄