Implementing a repository

We will create a new repository, ReactiveMovieRepository, with our two curated methods and all of the default methods provided by our extended class:

@Repository
public interface ReactiveMovieRepository extends
ReactiveMongoRepository<Movie, Long> {
@Query("{ 'title': ?0, 'genre': ?1}")
Flux<Movie> findByTitleAndGenre(String title, String genre);
@Query("{ 'genre': ?0}")
Flux<Movie> findByGenre(String genre);
}

We will extend our repository from ReactiveMongoRepository. ReactiveMongoRepository has loads of common methods that can be used right away, without any trouble. The methods that we have implemented use plain queries against the MongoDB and return the list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.107.169