Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 2.43 KB

File metadata and controls

70 lines (46 loc) · 2.43 KB

Spring Data KeyValue Revved up by Develocity

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.

This module provides infrastructure components to build repository abstractions for stores dealing with Key/Value pairs and ships with a default java.util.Map based implementation.

Features

  • Infrastructure for building repositories on top of key/value implementations.

  • Dynamic SpEL query generation from query method names.

  • Possibility to integrate custom repository code.

Getting Started

Here is a quick teaser of an application using Spring Data Repositories in Java:

public interface PersonRepository extends CrudRepository<Person, Long> {

    List<Person> findByLastname(String lastname);

    List<Person> findByFirstnameLike(String firstname);
}

@Service
public class MyService {

    private final PersonRepository repository;

    public MyService(PersonRepository repository) {
        this.repository = repository;
    }

    public void doWork() {

        repository.deleteAll();

        Person person = new Person();
        person.setFirstname("Oliver");
        person.setLastname("Gierke");
        repository.save(person);

        List<Person> lastNameResults = repository.findByLastname("Gierke");
        List<Person> firstNameResults = repository.findByFirstnameLike("Oli*");
    }
}

@KeySpace("person")
class Person {

    @Id String uuid;
    String firstname;
    String lastname;

    // getters and setters omitted for brevity
}

@Configuration
@EnableMapRepositories("com.acme.repositories")
class AppConfig { … }