title: CRUD Repository findById() different return value
body: <p><strong>In my SpringBoot applicatication I'm using CrudRepo.
  I have found a problem with return value: Required != Found</strong></p>
  
  <p>GitHub: <a href="https://github.com/einhar/WebTaskManager/tree/findById-problem" rel="nofollow noreferrer">https://github.com/einhar/WebTaskManager/tree/findById-problem</a></p>
  
  <p>No matter about changing method return type from Task into Object -> IDE stopped show error, but then it could be problem due to validation of data type later on.</p>
  
  <p>Do you know how to fix it? Any hint?</p>
  
  <h2>CrudRepo</h2>
  
  <pre><code>public interface TaskRepository extends CrudRepository&lt;Task, Integer&gt; {}
  </code></pre>
  
  <h2>Service</h2>
  
  <pre><code>@Service
  @Transactional
  public class TaskService {
  
      @Autowired
      private final TaskRepository taskRepository;
  
      public TaskService(TaskRepository taskRepository) {
          this.taskRepository = taskRepository;
      }
  
      public List&lt;Task&gt; findAll() {
          List&lt;Task&gt; tasks = new ArrayList&lt;&gt;();
          for (Task task : taskRepository.findAll()) {
                  tasks.add(task);
          }
          return tasks; // Work properly :)
      }
      /* ... */
      public Task findTask(Integer id) {
          return taskRepository.findById(id); // Find:Task | Required: java.util.Optional :(
      }
  }
  </code></pre>