title: You have defined query method in the repository but you don't have any query lookup strategy defined. spring
body: <p>Have an issue starting up a postgresql r2dbs spring boot application. I am getting the below error for this configuration.:</p>
  
  <p>Inside main module:</p>
  
  <pre><code>  &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.projectreactor&lt;/groupId&gt;
              &lt;artifactId&gt;reactor-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-r2dbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.r2dbc&lt;/groupId&gt;
              &lt;artifactId&gt;r2dbc-postgresql&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;myGroupId&lt;/groupId&gt;
              &lt;artifactId&gt;myModule.dblib&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
          &lt;/dependency&gt;
         &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectreactor&lt;/groupId&gt;
              &lt;artifactId&gt;reactor-spring&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>App:</p>
  
  <pre><code>@SpringBootApplication(scanBasePackages = "com.pack")
  @EntityScan("com.pack")
  @EnableR2dbcRepositories
  @Import(DatabaseConfiguration.class)
  public class InventoryApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(InventoryApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>@Service
  @RequiredArgsConstructor
  public class InventoryService {
  
      private final ItemRepository itemRepository;
  
      public Flux&lt;ItemPojo&gt; getAllItems() {
          return itemRepository.findAllItems()
                               .map(Item::toPojo);
      }
  }
  </code></pre>
  
  <p>Repo:</p>
  
  <pre><code>    @Repository
  public interface ItemRepository extends ReactiveCrudRepository&lt;Item, Long&gt; {
  
      Flux&lt;List&lt;Item&gt;&gt; findByName(String name);
  
      @Query("select i from Item i")
      Flux&lt;Item&gt; findAllItems();
  
  }
  </code></pre>
  
  <p>Entity:</p>
  
  <pre><code>@Data
  @Table(name = "items")
  public class Item implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
  
      private String name;
  
      public static ItemPojo toPojo(final Item items) {
          return new ItemPojo(items.id, items.name);
      }
  }
  </code></pre>
  
  <p><strong>myModule.dblib:</strong></p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.projectreactor&lt;/groupId&gt;
              &lt;artifactId&gt;reactor-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-r2dbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.r2dbc&lt;/groupId&gt;
              &lt;artifactId&gt;r2dbc-postgresql&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-r2dbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.r2dbc&lt;/groupId&gt;
              &lt;artifactId&gt;r2dbc-postgresql&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectreactor&lt;/groupId&gt;
              &lt;artifactId&gt;reactor-spring&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>Database config:</p>
  
  <pre><code>@Configuration
  @EnableR2dbcRepositories
  public class DatabaseConfiguration extends AbstractR2dbcConfiguration{
  
      @Value("${spring.data.postgres.host}") private String host;
      @Value("${spring.data.postgres.port}") private int port;
      @Value("${spring.data.postgres.database}") private String database;
      @Value("${spring.data.postgres.username}") private String username;
      @Value("${spring.data.postgres.password}") private String password;
  
      @Bean
      public PostgresqlConnectionFactory connectionFactory() {
              return new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder()
                                                      .host(host)
                                                      .port(port)
                                                      .database(database)
                                                      .username(username)
                                                      .password(password)
                                                      .build());
          }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  
  
  2019-06-18 20:44:50,265 ERROR [main] org.springframework.boot.SpringApplication: Application run failed
  
  
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '/api/internal/inventory': Unsatisfied dependency expressed through field 'inventoryService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inventoryService' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/com/epi/services/inventory/items/InventoryService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
  
  
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
  
  
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
  
  
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1395)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
  
  
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  
  
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849)
  
  
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
  
  
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
  
  
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
  
  
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
  
  
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  
  
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
  
  
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
  
  
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
  
  
      at com.epi.services.inventory.InventoryApplication.main(InventoryApplication.java:17)
  
  
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  
  
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  
  
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  
  
      at java.base/java.lang.reflect.Method.invoke(Method.java:567)
  
  
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
  
  
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
  
  
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
  
  
      at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
  
  
  Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inventoryService' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/com/epi/services/inventory/items/InventoryService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
  
  
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
  
  
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1325)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1171)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
  
  
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  
  
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
  
  
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247)
  
  
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
  
  
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
  
  
      ... 27 common frames omitted
  
  
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
  
  
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
  
  
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  
  
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
  
  
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247)
  
  
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
  
  
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
  
  
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
  
  
      ... 40 common frames omitted
  
  
  Caused by: java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
  
  
      at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.&lt;init&gt;(RepositoryFactorySupport.java:532)
  
  
      at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317)
  
  
      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$3(RepositoryFactoryBeanSupport.java:287)
  
  
      at org.springframework.data.util.Lazy.getNullable(Lazy.java:141)
  
  
      at org.springframework.data.util.Lazy.get(Lazy.java:63)
  
  
      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:290)
  
  
      at org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactoryBean.afterPropertiesSet(R2dbcRepositoryFactoryBean.java:123)
  
  
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821)
  
  
      at org.springframework.beans.factor
  </code></pre>
  
  <p>Edit 1: New version of repository</p>
  
  <pre><code>import org.springframework.data.r2dbc.repository.query.Query;
  import org.springframework.data.repository.reactive.ReactiveCrudRepository;
  import org.springframework.stereotype.Repository;
  import reactor.core.publisher.Flux;
  import reactor.core.publisher.Mono;
  
  @Repository
  public interface ItemRepository extends ReactiveCrudRepository&lt;Item, Long&gt; {
  
      @Query("SELECT * from items WHERE name = $1")
      Mono&lt;Item&gt; findByName(String name);
  
      @Query("SELECT * from items")
      Flux&lt;Item&gt; findAllItems();
  
  }
  </code></pre>