Я пытаюсь подключить Spring data cassandra. У меня есть сервер cassandra, работающий в сети.Вот подробности
spring.data.cassandra.contact-points=192.168.33.10
spring.data.cassandra.cluster-name=GEO-LOCAL-Cluster
spring.data.cassandra.port=9042
spring.data.cassandra.keyspace-name=organizationlicenses
spring.data.cassandra.username=cassandra
spring.data.cassandra.password=cassandra
Я поставил им префикс через spring.data, когда пытался автоматически внедрить эти свойства.Но большинство примеров и информации, с которой я столкнулся, используют расширенный класс конфигурации, как показано ниже. CassandraConfig расширяет AbstractCassandraConfiguration ...
@Bean
public CassandraCqlClusterFactoryBean cluster() {
CassandraCqlClusterFactoryBean cluster =
new CassandraClusterFactoryBean();
cluster.setContactPoints(properties.getContactPoints());
cluster.setPort(properties.getPort());
cluster.setUsername(properties.getUsername());
cluster.setPassword(properties.getPassword());
return cluster;
}
Вот исключение, которое я получаю -
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [com/example/demo/DemoClientCassandraConfiguration.class]: Invocation of init method failed; nested exception is com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.33.10:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces))
Я не являюсьуверен, что я скучаю.Как указать имя кластера GEO-LOCAL-Cluster с помощью класса конфигурации.Я проследил, что все свойства заполнены правильно.
Я использовал @Table для класса сущности и @EnableCassandraRepositories для основного метода приложения.