title: Spring boot cassandra Failed to load ApplicationContext
body: <p>I am integrating spring boot, spring data jpa and cassandra. but getting below error. please help me to resolve this.</p>
  
  <pre><code>    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.lo
   adContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-
   5.0.0.RC3.jar:5.0.0.RC3]
  ... 26 common frames omitted
   Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did 
   not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.validate(OnBeanCondition.java:389) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.&lt;init&gt;(OnBeanCondition.java:379) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:113) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  ... 42 common frames omitted
  Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration.cassandraMapping
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:442) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanType(OnBeanCondition.java:426) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.&lt;init&gt;(OnBeanCondition.java:373) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  ... 44 common frames omitted
   Caused by: java.lang.ClassNotFoundException: org.springframework.data.cassandra.core.mapping.CassandraMappingContext
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
  at org.springframework.util.ClassUtils.forName(ClassUtils.java:255) ~[spring-core-5.0.0.RC3.jar:5.0.0.RC3]
  at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:436) ~[spring-boot-autoconfigure-2.0.0.M3.jar:2.0.0.M3]
  ... 46 common frames omitted
  
  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 28.532 sec 
  &lt;&lt;&lt; FAILURE! - in com.trendset.ecom.EcomApplicationTests
  contextLoads(com.trendset.ecom.EcomApplicationTests)  Time elapsed: 0.064 
  sec  &lt;&lt;&lt; ERROR!
   java.lang.IllegalStateException: Failed to load ApplicationContext
  Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration.cassandraMapping
   Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed
   Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration.cassandraMapping
   Caused by: java.lang.ClassNotFoundException: org.springframework.data.cassandra.core.mapping.CassandraMappingContext
  </code></pre>
  
  <p>Below are the spring, cassandra dependencies i am using.</p>
  
  <pre><code>   spring-boot-starter-data-jpa-1.5.5
     spring-boot-starter-web
     cassandra-driver-mapping(com.datastax.cassandra)
     spring-data-cassandra-1.0.0.RELEASE
    cassandra-driver-extras(com.datastax.cassandra)
  </code></pre>
  
  <p>Cassandra config file</p>
  
  <pre><code> @Configuration
   @PropertySource(value = { "classpath:cassandra.properties" })
   @EnableCassandraRepositories(basePackages = { "com.test.stu.cassandra" })
   public class CassandraConfig {
    private static final Logger LOG = 
   LoggerFactory.getLogger(CassandraConfig.class);
  
    @Autowired
    private Environment env;
  
    @Bean
    public CassandraClusterFactoryBean cluster() {
  
      CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean();
      cluster.setContactPoints(env.getProperty("cassandra.contactpoints"));
      cluster.setPort(Integer.parseInt(env.getProperty("cassandra.port")));
  
      return cluster;
    }
  
    @Bean
    public CassandraMappingContext mappingContext() {
      return new BasicCassandraMappingContext();
    }
  
    @Bean
    public CassandraConverter converter() {
      return new MappingCassandraConverter(mappingContext());
    }
  
    @Bean
    public CassandraSessionFactoryBean session() throws Exception {
  
      CassandraSessionFactoryBean session = new CassandraSessionFactoryBean();
      session.setCluster(cluster().getObject());
      session.setKeyspaceName(env.getProperty("cassandra.keyspace"));
      session.setConverter(converter());
      session.setSchemaAction(SchemaAction.NONE);
  
      return session;
    }
  
    @Bean
    public CassandraOperations cassandraTemplate() throws Exception {
      return new CassandraTemplate(session().getObject());
    }
   }
  </code></pre>
  
  <p>somebody please let me know what else I need to do to integrate cassandra with spring-data jpa and spring boot.</p>
  
  <p>Thanks in advance</p>