From 4f23aa2c1bb9eb95ffb9f6e75117e21ee6e7b95e Mon Sep 17 00:00:00 2001 From: roimenashe Date: Sun, 10 Oct 2021 10:27:27 +0300 Subject: [PATCH] README code samples format. --- README.md | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 8c724240b..1b0af3831 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The primary goal of the [Spring Data](https://projects.spring.io/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. -The Spring Data Aerospike project aims to provide a familiar and consistent Spring-based programming model for new datastores while retaining store-specific features and capabilities. The Spring Data Aerospike project provides integration with the Aerospike document database. Key functional areas of Spring Data Aerospike are a POJO centric model for interacting with an Aerospike DBCollection and easily writing a repository style data access layer. +The Spring Data Aerospike project aims to provide a familiar and consistent Spring-based programming model for new data stores while retaining store-specific features and capabilities. The Spring Data Aerospike project provides integration with the Aerospike document database. Key functional areas of Spring Data Aerospike are a POJO centric model for interacting with an Aerospike DBCollection and easily writing a repository style data access layer. ## Documentation @@ -84,9 +84,9 @@ For example, given a `Person` class with first and last name properties, a `Pers ```java public interface PersonRepository extends AerospikeRepository { - List findByLastname(String lastname); + List findByLastname(String lastname); - List findByFirstnameLike(String firstname); + List findByFirstnameLike(String firstname); } ``` @@ -98,17 +98,16 @@ You can have Spring automatically create a proxy for the interface by using the @Configuration @EnableAerospikeRepositories(basePackageClasses = PersonRepository.class) class ApplicationConfig extends AbstractAerospikeDataConfiguration { - - @Override + + @Override protected Collection getHosts() { - return Collections.singleton(new Host("localhost", 3000)); + return Collections.singleton(new Host("localhost", 3000)); } - + @Override protected String nameSpace() { - return "TEST"; + return "TEST"; } - } ``` @@ -120,25 +119,24 @@ This will find the repository interface and register a proxy object in the conta @Service public class MyService { - private final PersonRepository repository; + private final PersonRepository repository; - @Autowired - public MyService(PersonRepository repository) { - this.repository = repository; - } - - public void doWork() { + @Autowired + public MyService(PersonRepository repository) { + this.repository = repository; + } - repository.deleteAll(); + public void doWork() { + repository.deleteAll(); - Person person = new Person(); - person.setFirstname("Oliver"); - person.setLastname("Gierke"); - person = repository.save(person); + Person person = new Person(); + person.setFirstname("Oliver"); + person.setLastname("Gierke"); + repository.save(person); - List lastNameResults = repository.findByLastname("Gierke"); - List firstNameResults = repository.findByFirstnameLike("Oli*"); - } + List lastNameResults = repository.findByLastname("Gierke"); + List firstNameResults = repository.findByFirstnameLike("Oli*"); + } } ```