Files
spring-data/index.html
John Blum 62dc2b4e86 Change branding from Gemfire to Pivotal GemFire.
Change branding from Spring Data Gemfire to Spring Data for Pivotal GemFire.
2018-05-07 18:14:32 -07:00

196 lines
9.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 JDBC](http://projects.spring.io/spring-data-jdbc) - JDBC-based repositories.
* [Spring Data KeyValue](https://github.com/spring-projects/spring-data-keyvalue) - `Map`-based repositories and SPIs to easily build a Spring Data module for key-value stores.
* [Spring Data LDAP](http://projects.spring.io/spring-data-ldap) - Provides Spring Data repository support for [Spring LDAP](https://github.com/spring-projects/spring-ldap).
* [Spring Data MongoDB](http://projects.spring.io/spring-data-mongodb) - Spring based, object-document support and repositories for MongoDB.
* [Spring Data REST](http://projects.spring.io/spring-data-rest) - Exports Spring Data repositories as hypermedia-driven RESTful resources.
* [Spring Data Redis](http://projects.spring.io/spring-data-redis) - Provides easy configuration and access to Redis from Spring applications.
* [Spring Data for Apache Cassandra](http://projects.spring.io/spring-data-cassandra) - Spring Data module for Apache Cassandra.
* [Spring Data for Apache Solr](http://projects.spring.io/spring-data-solr) - Spring Data module for Apache Solr.
* [Spring Data for Pivotal GemFire](http://projects.spring.io/spring-data-gemfire) - Provides easy configuration and access to Pivotal GemFire from Spring applications.
<a name="community-modules"></a>
## Community modules
* [Spring Data Aerospike](https://github.com/aerospike/spring-data-aerospike) - Spring Data module for Aerospike.
* [Spring Data ArangoDB](https://github.com/arangodb/spring-data) - Spring Data module for ArangoDB.
* [Spring Data Couchbase](http://projects.spring.io/spring-data-couchbase) - Spring Data module for Couchbase.
* [Spring Data Azure Cosmos DB](https://github.com/Microsoft/spring-data-cosmosdb) - Spring Data module for Microsoft Azure Cosmos DB.
* [Spring Data DynamoDB](https://github.com/spring-data-dynamodb/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 Hazelcast](https://github.com/hazelcast/spring-data-hazelcast) - Provides Spring Data repository support for Hazelcast.
* [Spring Data Jest](https://github.com/VanRoy/spring-data-jest) - Spring Data for Elasticsearch based on the Jest REST client.
* [Spring Data Neo4j](http://projects.spring.io/spring-data-neo4j) - Spring based, object-graph support and repositories for Neo4j.
* [Spring Data Spanner](https://github.com/spring-cloud/spring-cloud-gcp) - Google Spanner support via Spring Cloud GCP.
* [Spring Data Vault](https://projects.spring.io/spring-vault/) - Vault repositories built on top of Spring Data KeyValue.
<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.
* [Spring Content](https://paulcwarren.github.io/spring-content/) - Associate content with your Spring Data Entities and store it in a number of different stores including the File-system, S3, Database or Mongo's GridFS.
<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.
Currently the release train contains the following modules:
* Spring Data Commons
* Spring Data JPA
* Spring Data KeyValue
* Spring Data LDAP
* Spring Data MongoDB
* Spring Data REST
* Spring Data Redis
* Spring Data for Apache Cassandra
* Spring Data for Apache Geode
* Spring Data for Apache Solr
* Spring Data for Pivotal GemFire
* Spring Data Couchbase (community module)
* Spring Data Elasticsearch (community module)
* Spring Data Neo4j (community module)
<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>