With the domain model implemented successfully, CrudRepository for those can be implemented using Spring Data Redis. The specialty here is that there is no need to implement anything. Just writing an interface that extends from the CrudRepository interface would be sufficient to expose methods to find one, find all, save, delete, and so on. The following code shows the TaxiRepository, which is available in the spring-boot-2-taxi-service:
@Repository
public interface TaxiRepository extends CrudRepository<Taxi, String> {
}
The @Repository annotation is used to mark this interface as a data repository component of Spring. The following code shows TaxiBookingRepository, which is available in spring-boot-2-taxi-book-service:
@Repository
public interface TaxiBookingRepository extends CrudRepository<TaxiBooking, String> {
}