How to do it...

Spring 5 offers asynchronous service layer that can be called by any asynchronous controllers. Let us build these service layer using the following steps:

  1. 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.
  2. 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 ...

Get Spring 5.0 Cookbook 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.