Skip to content
Merged
Show file tree
Hide file tree
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
30 changes: 3 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Create a CRUD repository interface [UserRepository](https://github.com/derjust/s
@EnableScan
public interface UserRepository extends CrudRepository<User, String> {
List<User> findByLastName(String lastName);
List<User> findByFirstName(String firstName);
}
```

Expand All @@ -96,6 +97,7 @@ or for paging and sorting...
```java
public interface PagingUserRepository extends PagingAndSortingRepository<User, String> {
Page<User> findByLastName(String lastName, Pageable pageable);
Page<User> findByFirstName(String firstName, Pageable pageable);

@EnableScan
@EnableScanCount
Expand Down Expand Up @@ -142,34 +144,8 @@ public static class DynamoDBConfig {
}
```

And finally write a test client [UserRepositoryIT](https://github.com/derjust/spring-data-dynamodb-examples/blob/master/src/test/java/com/github/derjust/spring_data_dynamodb_examples/simple/UserRepositoryIT.java):
And finally write a test client [UserRepositoryIT](https://github.com/derjust/spring-data-dynamodb-examples/blob/master/src/test/java/com/github/derjust/spring_data_dynamodb_examples/simple/UserRepositoryIT.java) or start calling it from your existing Spring code.

```java
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { PropertyPlaceholderAutoConfiguration.class, DynamoDBConfig.class })
public class UserRepositoryIT {
private static final Logger log = LoggerFactory.getLogger(UserRepositoryIT.class);

@Autowired
private UserRepository repository;

@Test
public void sampleTestCase() {
User gosling = new User("James", "Gosling");
repository.save(gosling);

User hoeller = new User("Juergen", "Hoeller");
repository.save(hoeller);

List<User> result = repository.findByLastName("Gosling");
Assert.assertThat(result.size(), is(1));
Assert.assertThat(result, hasItem(gosling));
log.info("Found in table: {}", result.get(0));
}

// setup code
}
```

The full source code is available at [spring-data-dynamodb-examples' simple example](https://github.com/derjust/spring-data-dynamodb-examples/blob/master/README-simple.md)

Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,10 @@
<name>Alex Simkin</name>
<url>https://github.com/SimY4</url>
</contributor>
<contributor>
<name>Rene Enriquez</name>
<url>enriquezrene</url>
</contributor>
</contributors>


Expand Down