title: Spring Boot - Validation failed for query for method public abstract java.util.stream.Stream
body: <p>I need to stream a Object List, but when i try it using JpaRepository and @Query, i receive this exception:</p>
  
  <p><code>Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MainApplication': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyServiceImpl': Unsatisfied dependency expressed through field 'myDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyDAO': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.stream.Stream com.my.package.dao.MyDAO.streamAll()!</code></p>
  
  <p>MyDAO code:</p>
  
  <pre><code>@Repository
  public interface MyDAO extends JpaRepository&lt;MyEntity, Long&gt; {
  
      @QueryHints(value = @QueryHint(name = HINT_FETCH_SIZE, value = "" + 
          Integer.MIN_VALUE))
      @Query(value = "SELECT m FROM MyEntity m")
      Stream&lt;MyEntity&gt; streamAll();
  
      ...
  }
  </code></pre>
  
  <p>Main code: </p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan("com.my.package.*")
  @EntityScan("com.my.package.*")
  @Configuration
  @EnableAutoConfiguration
  public class MainApplication implements CommandLineRunner {
  
      @Autowired
      MyServiceInterface service;
  
  
      public static void main(String[] args) {
          SpringApplication.run(MainApplication.class, args);
      }
  
      @Override
      public void run(String... args) throws Exception {
  
          try {
              service.createCsv();
          } catch (RuntimeException e) {
              System.out.println(e);
          }
  
      }
  
  }
  </code></pre>
  
  <p>I have tried everything but nothing works, please help me!</p>