Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README code samples format. #304

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -84,9 +84,9 @@ For example, given a `Person` class with first and last name properties, a `Pers
```java
public interface PersonRepository extends AerospikeRepository<Person, Long> {

List<Person> findByLastname(String lastname);
List<Person> findByLastname(String lastname);

List<Person> findByFirstnameLike(String firstname);
List<Person> findByFirstnameLike(String firstname);
}
```

Expand All @@ -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<Host> getHosts() {
return Collections.singleton(new Host("localhost", 3000));
return Collections.singleton(new Host("localhost", 3000));
}

@Override
protected String nameSpace() {
return "TEST";
return "TEST";
}

}
```

Expand All @@ -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<Person> lastNameResults = repository.findByLastname("Gierke");
List<Person> firstNameResults = repository.findByFirstnameLike("Oli*");
}
List<Person> lastNameResults = repository.findByLastname("Gierke");
List<Person> firstNameResults = repository.findByFirstnameLike("Oli*");
}
}
```

Expand Down