Book Image

Spring Data

By : Petri Kainulainen
Book Image

Spring Data

By: Petri Kainulainen

Overview of this book

Spring Framework has always had a good support for different data access technologies. However, developers had to use technology-specific APIs, which often led to a situation where a lot of boilerplate code had to be written in order to implement even the simplest operations. Spring Data changed all this. Spring Data makes it easier to implement Spring-powered applications that use cloud-based storage services, NoSQL databases, map-reduce frameworks or relational databases. "Spring Data" is a practical guide that is full of step-by-step instructions and examples which ensure that you can start using the Java Persistence API and Redis in your applications without extra hassle. This book provides a brief introduction to the underlying data storage technologies, gives step-by-step instructions that will help you utilize the discussed technologies in your applications, and provides a solid foundation for expanding your knowledge beyond the concepts described in this book. You will learn an easier way to manage your entities and to create database queries with Spring Data JPA. This book also demonstrates how you can add custom functions to your repositories. You will also learn how to use the Redis key-value store as data storage and to use its other features for enhancing your applications. "Spring Data" includes all the practical instructions and examples that provide you with all the information you need to create JPA repositories with Spring Data JPA and to utilize the performance of Redis in your applications by using Spring Data Redis.
Table of Contents (13 chapters)

Chapter 5. Getting Started with Spring Data Redis

Before the Spring Data Redis project was born, a normal way to communicate with Redis was to use client libraries that can be compared to the JDBC drivers of relational databases. The difference is that these clients do not implement a standard API that makes it hard to switch from one connector to another. Obviously, the million-dollar question is, how can Spring Data Redis make our life easier?

Spring Data Redis hides the APIs of different client libraries behind a single API that is clean and easy to use. In theory, this ensures that we can change the used Redis connector without making any changes to our application. Even though this is indeed a useful feature if we have to change the used connector, it would be naive to claim that we should start using Spring Data Redis only because of this feature. We have to remember that we will most likely stick with one Redis connector throughout the life cycle of our application.

However, we must...