1 package de.spring.webservices.rest.business.service.impl;
3 import java.util.concurrent.CompletableFuture;
5 import javax.inject.Inject;
7 import org.springframework.data.domain.Page;
8 import org.springframework.data.domain.Pageable;
9 import org.springframework.stereotype.Service;
11 import de.spring.webservices.domain.Car;
12 import de.spring.webservices.rest.business.service.AwesomeBusinessLogic;
13 import de.spring.webservices.rest.business.service.CompletableFutureBusinessLogic;
15 @Service("completableFutureBusinessLogic")
16 public class CompletablefutureBusinessLogicImpl implements CompletableFutureBusinessLogic {
17 private final AwesomeBusinessLogic awesomeBusinessLogic;
20 public CompletablefutureBusinessLogicImpl(AwesomeBusinessLogic awesomeBusinessLogic) {
21 this.awesomeBusinessLogic = awesomeBusinessLogic;
25 public CompletableFuture<Page<Car>> findAll(Pageable pageRequest) {
26 return CompletableFuture.supplyAsync(() -> awesomeBusinessLogic.findAll(pageRequest));
30 public CompletableFuture<Car> findById(long id) {
31 return CompletableFuture.supplyAsync(() -> awesomeBusinessLogic.findById(id));
35 public CompletableFuture<Car> create(Car car) {
36 return CompletableFuture.supplyAsync(() -> awesomeBusinessLogic.create(car));