Я настроил свой клиент cassandra данных Spring с помощью весенней загрузки application.yml и автоконфигурации.
Это работает для меня, но только когда я не использую свойство spring.data.reconnection-policy.Когда я использую любой из них ( com.datastax.driver.core.policies.ConstantReconnectionPolicy или com.datastax.driver.core.policies.ExponentialReconnectionPolicy ), я получаю эту ошибку при запуске:
Причина: org.springframework.beans.BeanInstantiationException: Не удалось создать экземпляр [com.datastax.driver.core.policies.ConstantReconnectionPolicy]: Конструктор по умолчанию не найден ;Вложенным исключением является java.lang.NoSuchMethodException: com.datastax.driver.core.policies.ConstantReconnectionPolicy. () в org.springframework.beans.BeanUtils.instantiateClass (BeanUtils.java:127) ~ [spring-beans-5.0.7.RELEASE.jar: 5.0.7.RELEASE] в org.springframework.boot.context.properties.PropertyMapper $ Source.lambda $ as $ 2 (PropertyMapper.java:207) ~ [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE] at org.springframework.boot.context.properties.PropertyMapper $ Source.to (PropertyMapper.java:302) ~ [spring-boot-2.0.3.RELEASE.jar: 2.0.3.RELEASE] вorg.springframework..cassandra.CassandraAutoConfiguration $$ EnhancerBySpringCGLIB $$ 2f475e40.CGLIB $ cassandraCluster $ 0 () ~ [spring-boot-autoconfigure-2.0.3.RELEASE.jar: 2.0.3.RELEASE]
1016
1016класс политики и добавленная конструкция по умолчаниюТор там.С новым классом внутри моего application.yml все работает.Можно ли настроить политику переподключения без обходного пути или это ошибка?
Заранее спасибо.
Это мое application.yml:
spring: data: cassandra:# Имя кластера Кассандра.имя кластера: «Тестовый кластер»
# Cluster node addresses.
contact-points: 10.247.198.137
# Login user of the server.
username: cassandra
# Login password of the server.
password: cassandra
# Compression supported by the Cassandra binary protocol.
compression: none
# Port of the Cassandra server.
port: 9042
# Socket option: connection time out.
connect-timeout: 5000ms
# Queries consistency level.
consistency-level: three
# Queries default fetch size.
fetch-size: 5000
# Keyspace name to use.
keyspace-name: testkeyspace
# Enable SSL support.
ssl: true
# Class name of the load balancing policy.
load-balancing-policy: com.datastax.driver.core.policies.RoundRobinPolicy
# Reconnection policy class.
reconnection-policy: com.datastax.driver.core.policies.ConstantReconnectionPolicy
# Class name of the retry policy.
retry-policy: com.datastax.driver.core.policies.DefaultRetryPolicy
# Heartbeat interval after which a message is sent on an idle connection to make sure it's still alive. If a duration suffix is not specified, seconds will be used.
pool.heartbeat-interval: 30s
# Idle timeout before an idle connection is removed. If a duration suffix is not specified, seconds will be used.
pool.idle-timeout: 120s
# Maximum number of requests that get queued if no connection is available.
pool.max-queue-size: 256
# Pool timeout when trying to acquire a connection from a host's pool.
pool.pool-timeout: 5000ms
# Socket option: read time out.
read-timeout: 5000ms
# Type of Cassandra repositories to enable.
repositories.type: auto
# Queries serial consistency level.
serial-consistency-level: three
# Schema action to take at startup.
schema-action: RECREATE_DROP_UNUSED