title: Rest endpoint with CompletableFuture vs Rest endpoint without CompletableFuture
body: <p>What is the difference between getPerson endpoint in PersonController and PersonController1 in the code below? </p>
  
  <p>In this specific case, what are the benefits of using CompletableFuture?</p>
  
  <pre><code>@RestController
  public class PersonController {
  
      @Autowired
      private PersonService personService;
  
  
      @GetMapping("/persons/{personId}" )
      public CompletableFuture&lt;Person&gt; getPerson(@PathVariable("personId") Integer personId) {
  
          return CompletableFuture.supplyAsync(() -&gt; personService.getPerson(personId));
      }
  }
  </code></pre>
  
  <pre><code>@RestController
  public class PersonController1 {
  
      @Autowired
      private PersonService personService;
  
  
      @GetMapping("/persons/{personId}" )
      public Person getPerson(@PathVariable("personId") Integer personId) {
  
          return personService.getPerson(personId);
      }
  }
  </code></pre>
  
  <pre><code>@Service
  public class PersonService {
  
  
      @Autowired
      PersonRepository personRepository;
  
      @Transactional
      public Person getPerson(int personId) {
  
          return personRepository.getPerson(personId);//this will get the data from the DB
  
      }
  }
  </code></pre>