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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.