title: How to customize AbstractCassandraConfiguration class?
body: <p>I am new to Spring framework.  I am working on a Spring Data Cassandra project where I want to set up a Cassandra keyspace and table programmatically.  Most of the examples I found on the Web require manual set up of them using cqlsh.</p>
  
  <p>As a start, I create a spring starter project on STS4 with only the Cassandra dependency selected.  Here are the dependencies in my pom file:</p>
  
  <pre><code>    &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-cassandra&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;/dependencies&gt;
  </code></pre>
  
  <p>Then I added my CassandraConfiguration class which extends the AbstractCassandraConfiguration class.  I fixed editor warning by implementing the only missing method getKeyspaceName().  Here is my added code.</p>
  
  <pre><code>package com.example.demo;
  
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.cassandra.config.AbstractCassandraConfiguration;
  import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories;
  
  @Configuration
  @EnableCassandraRepositories
  public class CassandraConfiguration extends AbstractCassandraConfiguration {
  
      @Override
      protected String getKeyspaceName() {
          return "demo";
      }
  
  }
  </code></pre>
  
  <p>But when I launch my spring boot app, it has the following error:</p>
  
  <pre><code>2019-04-18 14:54:24.588  INFO 38410 --- [           main] com.datastax.driver.core                 : DataStax Java driver 3.6.0 for Apache Cassandra
  2019-04-18 14:54:24.590  INFO 38410 --- [           main] c.d.driver.core.GuavaCompatibility       : Detected Guava &gt;= 19 in the classpath, using modern compatibility layer
  2019-04-18 14:54:24.694  INFO 38410 --- [           main] com.datastax.driver.core.ClockFactory    : Using native clock to generate timestamps.
  2019-04-18 14:54:24.880  INFO 38410 --- [           main] com.datastax.driver.core.NettyUtil       : Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
  2019-04-18 14:54:24.909  WARN 38410 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [com/example/demo/CassandraConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/codahale/metrics/JmxReporter
  2019-04-18 14:54:27.174  INFO 38410 --- [           main] ConditionEvaluationReportLoggingListener : 
  
  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2019-04-18 14:54:27.182 ERROR 38410 --- [           main] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [com/example/demo/CassandraConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/codahale/metrics/JmxReporter
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$76/1793436274.getObject(Unknown Source) ~[na:na]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:830) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.5.BUILD-SNAPSHOT.jar:2.1.5.BUILD-SNAPSHOT]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.5.BUILD-SNAPSHOT.jar:2.1.5.BUILD-SNAPSHOT]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.5.BUILD-SNAPSHOT.jar:2.1.5.BUILD-SNAPSHOT]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.BUILD-SNAPSHOT.jar:2.1.5.BUILD-SNAPSHOT]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.BUILD-SNAPSHOT.jar:2.1.5.BUILD-SNAPSHOT]
      at com.example.demo.CassandraDemoApplication.main(CassandraDemoApplication.java:10) [classes/:na]
  Caused by: java.lang.NoClassDefFoundError: com/codahale/metrics/JmxReporter
      at com.datastax.driver.core.Metrics.&lt;init&gt;(Metrics.java:146) ~[cassandra-driver-core-3.6.0.jar:na]
      at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1501) ~[cassandra-driver-core-3.6.0.jar:na]
      at com.datastax.driver.core.Cluster.init(Cluster.java:208) ~[cassandra-driver-core-3.6.0.jar:na]
      at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:376) ~[cassandra-driver-core-3.6.0.jar:na]
      at com.datastax.driver.core.Cluster.connect(Cluster.java:332) ~[cassandra-driver-core-3.6.0.jar:na]
      at org.springframework.data.cassandra.config.CassandraCqlSessionFactoryBean.connect(CassandraCqlSessionFactoryBean.java:89) ~[spring-data-cassandra-2.1.6.RELEASE.jar:2.1.6.RELEASE]
      at org.springframework.data.cassandra.config.CassandraCqlSessionFactoryBean.afterPropertiesSet(CassandraCqlSessionFactoryBean.java:82) ~[spring-data-cassandra-2.1.6.RELEASE.jar:2.1.6.RELEASE]
      at org.springframework.data.cassandra.config.CassandraSessionFactoryBean.afterPropertiesSet(CassandraSessionFactoryBean.java:59) ~[spring-data-cassandra-2.1.6.RELEASE.jar:2.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
      ... 16 common frames omitted
  Caused by: java.lang.ClassNotFoundException: com.codahale.metrics.JmxReporter
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_45]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_45]
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_45]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_45]
      ... 26 common frames omitted
  </code></pre>
  
  <p>So apparently besides the missing method, there are other things I need to add to my config class to make it work.  Can someone give me an idea what I am missing and how to proceed?</p>