Book Image

Spring 5.0 Cookbook

By : Sherwin John C. Tragura
Book Image

Spring 5.0 Cookbook

By: Sherwin John C. Tragura

Overview of this book

The Spring framework has been the go-to framework for Java developers for quite some time. It enhances modularity, provides more readable code, and enables the developer to focus on developing the application while the underlying framework takes care of transaction APIs, remote APIs, JMX APIs, and JMS APIs. The upcoming version of the Spring Framework has a lot to offer, above and beyond the platform upgrade to Java 9, and this book will show you all you need to know to overcome common to advanced problems you might face. Each recipe will showcase some old and new issues and solutions, right from configuring Spring 5.0 container to testing its components. Most importantly, the book will highlight concurrent processes, asynchronous MVC and reactive programming using Reactor Core APIs. Aside from the core components, this book will also include integration of third-party technologies that are mostly needed in building enterprise applications. By the end of the book, the reader will not only be well versed with the essential concepts of Spring, but will also have mastered its latest features in a solution-oriented manner.
Table of Contents (20 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Using Spring Data MongoDB


Spring Framework has been supporting MongoDB, Apache Cassandra, and Redis when it comes to NoSQL data transactions. Each data repository has its own Spring Data module that developers can use without much effort on the configuration side. Spring 5, with the help of Spring Boot 2.0, can still provide support to MongoDB, and both non-blocking and Reactive repository transactions. But this recipe is all about implementing Reactive Spring Data MongoDB repository properties.

Getting ready

Again, open ch12-mongodb without removing previous Spring Data JPA reactive components.

How to do it...

Let us not use the dedicated Spring Data MongoDB to implement Reactive repository transactions:

  1. Add the following Reactive Spring Data MongoDB dependency in the pom.xml file:
<dependency>             
    <groupId>org.springframework.boot</groupId>           
    <artifactId>spring-boot-starter-data-mongodb-reactive 
</artifactId>       
</dependency&gt...