@@ -10,15 +10,15 @@ Redis Repository support allows to convert, store, retrieve and index entities w
1010@RedisHash (" persons" )
1111class Person {
1212
13- @Id String id;
14-
15- @Indexed String firstname;
16- @Indexed String lastname;
13+ @Id String id;
1714
18- Gender gender ;
19- Address address ;
15+ @Indexed String firstname ;
16+ @Indexed String lastname ;
2017
21- @Reference List<Person > children;
18+ Gender gender;
19+ Address address;
20+
21+ @Reference List<Person > children;
2222}
2323```
2424
@@ -81,36 +81,36 @@ The below configuration uses [Jedis](https://github.com/xetorthio/jedis) to conn
8181@EnableRedisRepositories
8282class AppConfig {
8383
84- @Bean
85- RedisConnectionFactory connectionFactory () {
86- return new JedisConnectionFactory ();
87- }
84+ @Bean
85+ RedisConnectionFactory connectionFactory () {
86+ return new JedisConnectionFactory ();
87+ }
8888
89- @Bean
90- RedisTemplate<?, ?> redisTemplate (RedisConnectionFactory connectionFactory ) {
89+ @Bean
90+ RedisTemplate<?, ?> redisTemplate (RedisConnectionFactory connectionFactory ) {
9191
92- RedisTemplate<byte[], byte[]> template = new RedisTemplate<byte[], byte[]> ();
93- template. setConnectionFactory(connectionFactory);
92+ RedisTemplate<byte[], byte[]> template = new RedisTemplate<byte[], byte[]> ();
93+ template. setConnectionFactory(connectionFactory);
9494
95- return template;
96- }
95+ return template;
96+ }
9797}
9898```
9999
100- Having the infrastructure in place you can go on declaring and using the ` Repository ` interface.
100+ Having the infrastructure in place you can go on declaring and using the ` Repository ` interface.
101101
102102``` java
103103interface PersonRepository extends CrudRepository<Person , String > {
104104
105- List<Person > findByLastname (String lastname );
105+ List<Person > findByLastname (String lastname );
106106
107- Page<Person > findByLastname (String lastname , Pageable page );
107+ Page<Person > findByLastname (String lastname , Pageable page );
108108
109- List<Person > findByFirstnameAndLastname (String firstname , String lastname );
109+ List<Person > findByFirstnameAndLastname (String firstname , String lastname );
110110
111- List<Person > findByFirstnameOrLastname (String firstname , String lastname );
111+ List<Person > findByFirstnameOrLastname (String firstname , String lastname );
112112
113- List<Person > findByAddress_City (String city );
113+ List<Person > findByAddress_City (String city );
114114}
115115```
116116
0 commit comments