O'Reilly logo

Reactive Programming With Java 9 by Tejaswini Mandar Jog

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spring Data Repositories and Redis

Redis repositories allow developers to convert and store domain objects in Redis Hashes. The repository allows applying custom mapping strategies by making use of secondary indexes. We can simply use the annotation @EnableRedisRepositories for enabling Redis-based repositories.

In order to enable Redis to work with Spring Data, we need to follow these steps:

  1. Create a domain entity to be stored in the repository. Annotate the entity with the @RedisHash annotation.
  2. Now add the @Id annotation to make the data member work as the Primary Key.
  3. Create a basic repository to extend from the predefined repository.
  4. The final step is to enable the repository to be discovered using @EnableRedisRepository.
  5. Now declare ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required