Spring 5 offers asynchronous service layer that can be called by any asynchronous controllers. Let us build these service layer using the following steps:
- Before we start this recipe, the use of @Async requires a thorough and appropriate configuration of any TaskExecutor type in SpringAsynchConfig including some proxy-related configurations on @EnableAsync annotation.
- Create a package org.packt.web.reactor.service and add EmployeeService with some template methods:
public interface EmployeeService { public CompletableFuture<List<Employee>> readEmployees(); public Callable<List<Employee>> readEmployeesCall(); public Future<Employee> readEmployee(Integer empId); public void addEmployee(EmployeeForm emp); public void updateEmployee(EmployeeForm ...