Added mission statement to billboard description. Overhaul of feature list. More condensed view of the individual projects. Moved code samples to the Quick Start section. Moved release train section after the module listing. Removed detailed list of Spring Boot starters and linked to the reference documentation instead.
162 lines
7.4 KiB
HTML
162 lines
7.4 KiB
HTML
---
|
|
title: Spring Data
|
|
|
|
badges:
|
|
|
|
twitter: SpringData
|
|
|
|
# Customize your project's badges. Delete any entries that do not apply.
|
|
custom:
|
|
|
|
- name: StackOverflow
|
|
url: http://stackoverflow.com/questions/tagged/spring-data
|
|
icon: stackoverflow
|
|
---
|
|
<!DOCTYPE HTML>
|
|
<html lang="en-US">
|
|
|
|
{% capture billboard_description %}
|
|
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.
|
|
<br /><br />
|
|
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.
|
|
{% endcapture %}
|
|
|
|
{% capture main_content %}
|
|
|
|
## Features
|
|
|
|
* Powerful repository and custom object-mapping abstractions
|
|
* Dynamic query derivation from repository method names
|
|
* Implementation domain base classes providing basic properties
|
|
* Support for transparent auditing (created, last changed)
|
|
* Possibility to integrate custom repository code
|
|
* Easy Spring integration via JavaConfig and custom XML namespaces
|
|
* Advanced integration with Spring MVC controllers
|
|
* Experimental support for cross-store persistence
|
|
|
|
|
|
<a name="main-modules"></a>
|
|
## Main modules
|
|
|
|
<!-- Spring Data Commons -->
|
|
{% capture project_description %}
|
|
Core Spring concepts underpinning every Spring Data project.
|
|
{% endcapture %}
|
|
|
|
* [Spring Data Commons](http://docs.spring.io/spring-data/commons/docs/current/reference/html/) - Core Spring concepts underpinning every Spring Data project.
|
|
* [Spring Data JPA](http://projects.spring.io/spring-data-jpa) - Makes it easy to implement JPA-based repositories.
|
|
* [Spring Data MongoDB](http://projects.spring.io/spring-data-mongodb) - Spring based, object-document support and repositories for MongoDB.
|
|
* [Spring Data Redis](http://projects.spring.io/spring-data-redis) - Provides easy configuration and access to Redis from Spring applications.
|
|
* [Spring Data Solr](http://projects.spring.io/spring-data-solr) - Spring Data module for Apache Solr.
|
|
* [Spring Data Gemfire](http://projects.spring.io/spring-data-gemfire) - Provides easy configuration and access to GemFire from Spring applications.
|
|
* [Spring Data REST](http://projects.spring.io/spring-data-rest) - Exports Spring Data repositories as hypermedia-driven RESTful resources.
|
|
|
|
|
|
<a name="community-modules"></a>
|
|
## Community modules
|
|
|
|
* [Spring Data Cassandra](http://projects.spring.io/spring-data-cassandra) - Spring Data module for Apache Cassandra.
|
|
* [Spring Data Couchbase](http://projects.spring.io/spring-data-couchbase) - Spring Data module for Couchbase.
|
|
* [Spring Data DynamoDB](https://github.com/michaellavelle/spring-data-dynamodb) - Spring Data module for DynamoDB.
|
|
* [Spring Data Elasticsearch](http://projects.spring.io/spring-data-elasticsearch) - Spring Data module for Elasticsearch.
|
|
* [Spring Data Neo4j](http://projects.spring.io/spring-data-neo4j) - Spring based, object-graph support and repositories for Neo4j.
|
|
|
|
<a name="related-modules"></a>
|
|
## Related modules
|
|
|
|
* [Spring Data JDBC Extensions](http://projects.spring.io/spring-data-jdbc-ext) - Provides extensions to the JDBC support provided in the Spring Framework.
|
|
* [Spring for Apache Hadoop](http://projects.spring.io/spring-hadoop) - Simplifies Apache Hadoop by providing a unified configuration model and easy to use APIs for using HDFS, MapReduce, Pig, and Hive.
|
|
|
|
<a name="release-train"></a>
|
|
## Release train
|
|
|
|
Spring Data is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio, a BOM (Bill of Materials - see this [example](https://github.com/spring-projects/spring-data-examples/tree/master/bom)) is published with a curated set of dependencies on the individual project. The release trains have names, not versions, to avoid confusion with the sub-projects.
|
|
|
|
The names are an alphabetic sequence (so you can sort them chronologically) with names of famous computer scientists and software developers. When point releases of the individual projects accumulate to a critical mass, or if there is a critical bug in one of them that needs to be available to everyone, the release train will push out "service releases" with names ending "-SRX", where "X" is a number.
|
|
|
|
<a name="quick-start"></a>
|
|
## Quick Start
|
|
|
|
{% include download_widget.md %}
|
|
|
|
For a quick taste, look at the following domain object:
|
|
|
|
```java
|
|
@Entity
|
|
public class Employee {
|
|
|
|
private @Id @GeneratedValue Long id;
|
|
private String firstName, lastName, description;
|
|
|
|
private Employee() {}
|
|
|
|
public Employee(String firstName, String lastName, String description) {
|
|
this.firstName = firstName;
|
|
this.lastName = lastName;
|
|
this.description = description;
|
|
}
|
|
}
|
|
```
|
|
|
|
This defines a simple JPA entity with a few fields. The following code shows a simple repository definition:
|
|
|
|
```java
|
|
public interface EmployeeRepository extends CrudRepository<Employee, Long> {
|
|
|
|
Employee findByFirstName(String firstName);
|
|
|
|
List<Employee> findByLastName(String lastName);
|
|
}
|
|
```
|
|
|
|
This interface extends Spring Data's `CrudRepository` and defines the type (`Employee`) and the id type (`Long`). Put this code inside a Spring Boot application with `spring-boot-starter-data-jpa` like this:
|
|
|
|
```java
|
|
@SpringBootApplication
|
|
public class MyApp {
|
|
|
|
public static void main(String[] args) {
|
|
SpringApplication.run(MyApp.class, args);
|
|
}
|
|
}
|
|
```
|
|
|
|
Launch your app and Spring Data (having been autoconfigured by Boot, [SQL](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-sql) or [NoSQL](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-nosql)) will automatically craft a concrete set of operations:
|
|
|
|
* `save(Employee)`
|
|
* `delete(Employee)`
|
|
* `find(Employee)`
|
|
* `find(Long)`
|
|
* `findAll()`
|
|
|
|
On top of the CRUD operations inherited from `CrudRepository`, the interface defines two query methods.
|
|
|
|
* `findByFirstName(…)` automatically writes a JPA query based on firstName and only return the first employee found.
|
|
* `findByLastName(…)` automatically writes a JPA query based on lastName and returns a collection.
|
|
|
|
<a name="spring-boot-starters"></a>
|
|
## Spring Boot starters
|
|
|
|
If you are using Spring Boot, you will inherit predefined versions for each project. To plugin a newer or older release train, configure the `spring-data-releasetrain.version` property to the release train iteration name you want to use.
|
|
|
|
Spring Boot provides so called started POMs for a variety of SPring Data modules which pull in a curated set of dependencies you'll need to use the individual modules. For details on that see the [Spring Boot reference documentation](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter-poms).
|
|
|
|
<div style="padding-bottom: 20px;"></div>
|
|
|
|
<!-- end main_content -->
|
|
{% endcapture %}
|
|
|
|
{% capture related_resources %}
|
|
|
|
* [Spring Data - Release Train BOM Example](https://github.com/spring-projects/spring-data-examples/tree/master/bom)
|
|
* [Spring Data Examples](https://github.com/spring-projects/spring-data-examples)
|
|
* [Spring Data Book](http://www.amazon.com/Spring-Data-Mark-Pollack/dp/1449323952)
|
|
* [Getting Started Guides](https://spring.io/guides?filter=spring%20data)
|
|
|
|
{% endcapture %}
|
|
|
|
|
|
{% include project_page.html %}
|
|
|
|
</html>
|