title: Optional does not throw exception when the return value is null
body: <p>I am learning Spring Boot, I am trying to throw an exception when the service does not found an item on the database,therefore, I tried with optional but when I test it I only get a null response besides an exception</p>
  
  <pre><code>    @GetMapping(value = "/compras", produces = "application/json")
  public Optional&lt;Compras&gt; retrieveAllCompras(@RequestParam String id) {
      return Optional.of(compraRepository.findById(id)).orElseThrow(RuntimeException::new);
  </code></pre>
  
  <p>I expect an exception when the item is not found in Database</p>