title: DriverTimeoutException: Query timed out after PT2S. Unable to set spring.data.cassandra.request.timeout property?
body: <p>When starting my application the keyspace is always created and possibly one or two tables before the PT2S error message . Somehow the spring.data.cassandra.request.timeout property is not honored, or maybe there is something wrong with my configuration? The &quot;DriverConfigLoaderBuilderCustomizer&quot; bean does not make any difference.</p>
  <p>pom.xml</p>
  <pre><code>&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
  &lt;version&gt;2.3.5.RELEASE&lt;/version&gt;
  &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
  &lt;version&gt;Hoxton.SR9&lt;/version&gt;
  &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
  &lt;artifactId&gt;spring-data-cassandra&lt;/artifactId&gt;
  &lt;spring.framework.version&gt;5.3.1&lt;/spring.framework.version&gt;
  </code></pre>
  <p>application.yml</p>
  <pre><code>spring:
    data:
      cassandra:
        port: 9042
        keyspace-name: abc
        contact-points: localhost
        local-datacenter: datacenter1
        replication-factor: 1
        request:
          timeout: 15s
        connection:
          init-query-timeout: 15s
  </code></pre>
  <p>CassandraConfig.java</p>
  <pre><code>@Configuration
  @EnableReactiveCassandraRepositories(basePackages = &quot;a.b.c.repository&quot;)
  public class CassandraConfig extends AbstractReactiveCassandraConfiguration {
      @Value(&quot;${spring.data.cassandra.contactpoints}&quot;)
      .
      .
      @Override
      protected String getKeyspaceName() {
          return keyspace;
      }
      @Override protected String getContactPoints() {
          return contactPoints;
      }
      @Override protected int getPort() {
          return port;
      }
      @Override
      protected String getLocalDataCenter() {
          return datacenter;
      }
     @Override
      public SchemaAction getSchemaAction() {
          return SchemaAction.NONE;
      }
      @Override
      protected List&lt;CreateKeyspaceSpecification&gt; getKeyspaceCreations() {
          return Collections.singletonList(CreateKeyspaceSpecification.createKeyspace(getKeyspaceName())
                  .ifNotExists()
                  .with(KeyspaceOption.DURABLE_WRITES, true)
                  .withNetworkReplication(DataCenterReplication.of(getLocalDataCenter(), getReplicationFactor())));
      }
      @Override
      protected KeyspacePopulator keyspacePopulator() {
          ResourceKeyspacePopulator keyspacePopulate = new ResourceKeyspacePopulator();
          keyspacePopulate.addScript(new ClassPathResource(&quot;table-schema.cql&quot;));
          return keyspacePopulate;
      }
      private long getReplicationFactor() {
          return replicationFactor;
      }
      //@Bean
      //public DriverConfigLoaderBuilderCustomizer driverConfigLoaderBuilderCustomizer() {
          //return loaderBuilder -&gt; loaderBuilder
                  //.withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds(15))
                  //.withDuration(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, Duration.ofSeconds(15));
      //}
  
  }
  </code></pre>
  <p>Trimmed error log</p>
  <pre><code>BeanCreationException: Error creating bean with name 'cassandraSessionFactory' 
  Invocation of init method failed; nested exception is ScriptStatementFailedException: Failed to execute CQL script statement #2 of class path resource [table-schema.cql]: CREATE TABLE IF NOT EXISTS mytable...
  
  Caused by: org.springframework.data.cassandra.core.cql.session.init.ScriptStatementFailedException: Failed to execute CQL script statement #2 of class path resource [table-schema.cql]: CREATE TABLE IF NOT EXISTS mytanble... nested exception is com.datastax.oss.driver.api.core.DriverTimeoutException: Query timed out after PT2S
      at org.springframework.data.cassandra.core.cql.session.init.ScriptUtils.executeCqlScript(ScriptUtils.java:555) ~[spring-data-cassandra-3.0.5.RELEASE.jar:3.0.5.RELEASE]
      at org.springframework.data.cassandra.core.cql.session.init.ResourceKeyspacePopulator.populate
      
  Caused by: com.datastax.oss.driver.api.core.DriverTimeoutException: Query timed out after PT2S
  at com.datastax.oss.driver.api.core.DriverTimeoutException.copy(DriverTimeoutException.java:34)
  </code></pre>