Spring Data’s mission is to provide a familiar and consistent, Spring-based programming model for data access while still retaining the special traits of the underlying data store.

It makes it easy to use data access technologies, relational and non-relational databases, map-reduce frameworks, and cloud-based data services. This is an umbrella project which contains many subprojects that are specific to a given database. The projects are developed by working together with many of the companies and developers that are behind these exciting technologies. (Source)

In this article, we provide a compilation of Spring Data examples that will help you kick-start your own projects. We cover a wide range of topics, from setting up the environment and creating a basic project, to handling the various modules (e.g. JPA, MongoDB, Redis etc.). With our straightforward tutorials, you will be able to get your own projects up and running in minimum time.

1. Spring Data tutorial for beginners

In this example, we shall demonstrate how to configure Spring Framework to communicate with database using JPA and Hibernate as the JPA vendor.

The benefits of using Spring Data is that it removes a lot of boiler-plate code and provides a cleaner and more readable implementation of DAO layer. Also, it helps make the code loosely coupled and as such switching between different JPA vendors is a matter of configuration.

Read the rest of the article here.

2. Spring Data Gemfire Example

In the previous example, we demonstrated how we can connect to a Relational/SQL database with Spring using the Spring Data. In this example we will see how we can connect the Gemfire using the Spring Data.

Gemfire is a highly scalable, low-latency, in-memory data management platform which stores data in the key-value form. The data maybe persisted onto the disk. Gemfire provides it own set of tools for data management – gfsh, a command line utility tool.

Read the rest of the article here.

3. Spring Data Cassandra Example

In the previous example, we demonstrated the configuration of Spring Data with GemFire, an in-memory NoSQL Database. So continuing on the same series, in this example we shall demonstrate how to connect Spring Data Application to Apache Cassandra, a Column based NoSql Database.

Cassandra is a Distributed Database Management System that can handle large amounts of data with data replication across multiple data-centres so that there is no single point of failure.

Read the rest of the article here.

4. Spring Data Redis Example

In the past few examples, we have been integrating Spring Data with the NoSql Databases. In this example, we shall integrate Spring Data with Redis, a key-value based NoSQL Database.

Spring Data offers a level of abstraction over the traditional way of executing query by exposing a Repository. As such, the user need not write queries and call specific methods, depending upon the underlying Database.

Redis employs a key-store Data Structure to store data. It can be used to store complex data structure like List, Set, Hashes etc, which is why it is also referred to as Data-Structure Server.

Read the rest of the article here.

5. Spring Data MongoDB REST Example

In this tutorial, I will show you how to develop a RESTful web application by using Spring and MongoDB without implementing boring uniform controllers.

When it comes to RESTful application, we need an api that mainly handles CRUD operations. Let me give you example to clearify what I mean by sentence above. Let say that, you have a REST endpoint /products that allows you to perform product related operations like Product Create, Product Update, Product View, Product Delete, or Product Search.

Read the rest of the article here.

6. Spring Data Solr Example

In this example, we will demonstrate how to integrate Spring data with Apache Solr.

Solr is a search engine built on top of Apache Lucene library. It can be communicated with a REST like HTTP API because of which it can be easily be consumed as a REST-ful web-service irrespective of the underlying programming language used in the application which is calling the Solr Server. However, for the sake of this example we will be using Java as the programming language and Spring Data as the framework.

Read the rest of the article here.

7. Spring Data MongoDB Example

In this example, we will demonstrate how to connect Spring Data with MongoDb. MongoDb is also a document based NoSql Database like Solr, which we demonstrated past week.

Spring Data MongoDb is the module of Spring Data that provides support for MongoDb. As with the other modules demonstrated in this series, this module too provides supports both for derived queries(based on the method name) and the annotated query.

Read the rest of the article here.

8. Spring Data Rest Example

In the previous few examples we demonstrated how the different spring data modules are configured and their support for the NoSql databases. In this example, I will demonstrate how we can expose our CRUD Repository as a REST Web-Service over the HTTP.

We will be using MySQL as the database for this project . However, the application which we shall build here will be largely independent of the underlying Database technology used. This is because of the abstraction layer added by the Spring Data Module.

Read the rest of the article here.

9. Spring Data Neo4j Example

In this example we shall demonstrate how to integrate Neo4J, a graph based NoSql database with Spring Data.

Neo4j is an open source, graph based NoSQL database developed in Java and Scala. Like traditional relational Databases, Neo4J offers support to ACID properties. The graph based databases find their uses in use cases where the focus is strongly on inter-relationship between the entities of the domain like match-making,social networks, routing.

Read the rest of the article here.

10. Spring Data Elasticsearch Example

Elasticsearch is a highly scalable open-source which can be used for data store, text search and analytics engine. Every instance of ElasticSearch is called a node and several nodes can be grouped together in a cluster.

In this article, we will see how we can use spring-data-elasticsearch module which integrates spring-data and elasticsearch.

Read the rest of the article here.

11. Spring Data JPA Example

The goal of Spring Data repository abstraction is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores. If we try to implement a data access layer of an application on our own, we will end up with lots of boilerplate code.

Spring provides JPA module which not only eliminates boilerplate code but also takes care of the CRUD operations, provides inbuilt implementation for simple queries, performs pagination and auditing. Using Spring Data JPA we can write our own repository interfaces, including custom finder methods, and Spring will provide the implementation automatically. In this article we will see some examples of Spring Data JPA.

Read the rest of the article here.

12. Spring Data Couchbase Example

Couchbase is a highly scalable, Document based NoSQL Database. Document based NoSQL databases work on map-like concept of KEY-VALUE pairs. The key being uniquely identifiable property like a String, path etc and the value being the Document that is to be saved.

Spring Data CouchBase is the Spring module which helps us in integrating with the CouchBase Database Server.As with the other modules demonstrated in this series, this module too provides supports both for derived queries(based on the method names) and the annotated query.

Read the rest of the article here.