@Factory
public class CassandraSessionFactory
extends java.lang.Object
implements java.lang.AutoCloseable
Constructor and Description |
---|
CassandraSessionFactory(io.micronaut.core.value.PropertyResolver propertyResolver)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
com.datastax.oss.driver.api.core.CqlSession |
cassandraCluster(com.datastax.oss.driver.api.core.CqlSessionBuilder builder)
Creates the
CqlSession bean for the given configuration. |
void |
close()
closes all active
CqlSession . |
com.datastax.oss.driver.api.core.CqlSessionBuilder |
session(CassandraConfiguration configuration)
Creates the
CqlSessionBuilder bean for the given configuration. |
public CassandraSessionFactory(io.micronaut.core.value.PropertyResolver propertyResolver)
propertyResolver
- Property resolve for application configurations@EachBean(value=CassandraConfiguration.class) public com.datastax.oss.driver.api.core.CqlSessionBuilder session(CassandraConfiguration configuration)
CqlSessionBuilder
bean for the given configuration.configuration
- The cassandra configuration beanCqlSession
bean@EachBean(value=com.datastax.oss.driver.api.core.CqlSessionBuilder.class) @Bean(preDestroy="close") public com.datastax.oss.driver.api.core.CqlSession cassandraCluster(com.datastax.oss.driver.api.core.CqlSessionBuilder builder)
CqlSession
bean for the given configuration.builder
- The CqlSessionBuilder
CqlSession
bean@PreDestroy public void close()
CqlSession
.close
in interface java.lang.AutoCloseable