Search in sources :

Example 1 with Connection

use of org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Connection in project spring-boot by spring-projects.

the class CassandraAutoConfiguration method mapConnectionOptions.

private void mapConnectionOptions(CassandraProperties properties, CassandraDriverOptions options) {
    PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
    Connection connectionProperties = properties.getConnection();
    map.from(connectionProperties::getConnectTimeout).asInt(Duration::toMillis).to((connectTimeout) -> options.add(DefaultDriverOption.CONNECTION_CONNECT_TIMEOUT, connectTimeout));
    map.from(connectionProperties::getInitQueryTimeout).asInt(Duration::toMillis).to((initQueryTimeout) -> options.add(DefaultDriverOption.CONNECTION_INIT_QUERY_TIMEOUT, initQueryTimeout));
}
Also used : Connection(org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Connection) PropertyMapper(org.springframework.boot.context.properties.PropertyMapper)

Aggregations

Connection (org.springframework.boot.autoconfigure.cassandra.CassandraProperties.Connection)1 PropertyMapper (org.springframework.boot.context.properties.PropertyMapper)1