Skip to content

Commit 1d7dc8e

Browse files
committed
Merge branch 'Issue-199' of https://github.com/enriquezrene/spring-data-dynamodb into enriquezrene-Issue-199
2 parents 541c1bf + c12e92e commit 1d7dc8e

File tree

1 file changed

+3
-27
lines changed

1 file changed

+3
-27
lines changed

README.md

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Create a CRUD repository interface [UserRepository](https://github.com/derjust/s
8888
@EnableScan
8989
public interface UserRepository extends CrudRepository<User, String> {
9090
List<User> findByLastName(String lastName);
91+
List<User> findByFirstName(String firstName);
9192
}
9293
```
9394

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

100102
@EnableScan
101103
@EnableScanCount
@@ -142,34 +144,8 @@ public static class DynamoDBConfig {
142144
}
143145
```
144146

145-
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):
147+
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.
146148

147-
```java
148-
@RunWith(SpringRunner.class)
149-
@SpringBootTest(classes = { PropertyPlaceholderAutoConfiguration.class, DynamoDBConfig.class })
150-
public class UserRepositoryIT {
151-
private static final Logger log = LoggerFactory.getLogger(UserRepositoryIT.class);
152-
153-
@Autowired
154-
private UserRepository repository;
155-
156-
@Test
157-
public void sampleTestCase() {
158-
User gosling = new User("James", "Gosling");
159-
repository.save(gosling);
160-
161-
User hoeller = new User("Juergen", "Hoeller");
162-
repository.save(hoeller);
163-
164-
List<User> result = repository.findByLastName("Gosling");
165-
Assert.assertThat(result.size(), is(1));
166-
Assert.assertThat(result, hasItem(gosling));
167-
log.info("Found in table: {}", result.get(0));
168-
}
169-
170-
// setup code
171-
}
172-
```
173149

174150
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)
175151

0 commit comments

Comments
 (0)