I am using spring boot to connect to Cassandra Database.I am getting an error at startup that says
Error creating bean with name 'abcItemsRepository' defined in com.myspace.mycompany.repository defined in @EnableCassandraRepositories declared on CassandraRepositoriesRegistrar.EnableCassandraRepositoriesConfiguration: Cannot resolve reference to bean 'cassandraTemplate' while setting bean property 'cassandraTemplate'
Please help me in fixing it. Following are my configurations and repositories:
@Table("abc_items")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OboItems {
@Id
@PrimaryKeyColumn(name = "item_id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
@Column(name = "item_id")
private String itemId;
@Column(name = "last_scheduled_time")
private Date lastScheduledTime;
}
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
public interface OboItemsRepository extends CassandraRepository<OboItems,String> {
}
spring.data.cassandra.contact-points=<my-end-point>
spring.data.cassandra.port=9042
spring.data.cassandra.username=<username>
spring.data.cassandra.password=<password>
spring.data.cassandra.keyspace-name=<mykeyspace>
spring.data.cassandra.session.timeout=30000
I tried Configuring CassandraConfig that extends from AbstractCassandraConfiguration.But I had no luck with it. I am expecting the application to startup successfully and be able to run the cassandra queries in JPA style.
I was able to fix it using following cofigurations in addition to configurations in application.properties file.