To use the reactive data access for MongoDB instead of its synchronous counterpart, we have to add the following dependency to our Gradle project:
compile 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
Let's say we want to refactor our simple MongoDB application from the previous section to become reactive. In this case, we may leave the Book entity as is, without making any modifications. All the annotations associated with MongoDB Object-Document Mapping are the same for both synchronous and reactive MongoDB modules. However, in the repository, we now have to replace ordinary types with reactive types:
public interface ReactiveSpringDataMongoBookRepository extends ReactiveMongoRepository ...