Using a Service to encapsulate business logic

It is a good practice to encapsulate business logic inside Service methods so that controllers and repositories are loosely coupled. The following is a Service written for encapsulating business logic for Taxi, and is available in spring-boot-2-taxi-service:

@Servicepublic class TaxiService { private final ReactiveRedisTemplate<String, String> reactiveRedisTemplate; private final TaxiRepository taxiRepository; private final LocationToPointConverter locationToPointConverter = new  LocationToPointConverter(); public TaxiService(ReactiveRedisTemplate<String, String>  reactiveRedisTemplate, TaxiRepository taxiRepository) { this.reactiveRedisTemplate = reactiveRedisTemplate; this.taxiRepository 

Get Spring Boot 2.0 Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.