This project includes AutoConfiguration
for Embedded Cassandra.
To configure CassandraBuilder
before it builds Cassandra
, the application properties can be used. All properties are
started with a prefix cassandra.embedded
.
#Cassandra config file.
cassandra.embedded.config-file=classpath:cassandra.yaml
#Config properties, that should be merged with properties from cassandra.yaml.
cassandra.embedded.config-properties.native_transport_port=9042
#Cassandra environment variables.
cassandra.embedded.environment-variables.JAVA_HOME=~/java8
#Cassandra native Java Virtual Machine (JVM) Options.
cassandra.embedded.jvm-options=-Xmx512m
#Logger name, that consumes Cassandra STDOUT and STDERR outputs.
cassandra.embedded.logger=Cassandra
#Cassandra instance name.
cassandra.embedded.name=cassandra-0
#Sets if the created Cassandra should have a shutdown hook registered.
cassandra.embedded.register-shutdown-hook=true
#Startup timeout.
cassandra.embedded.startup-timeout=2m
#Cassandra native Java Virtual Machine (JVM) system parameters.
cassandra.embedded.system-properties.[cassandra.jmx.local.port]=7199
#Cassandra version.
cassandra.embedded.version=3.11.9
#Cassandra working directory.
cassandra.embedded.working-directory=target/cassandra-3.11.9
#Additional resources, that should be copied into the working directory.
cassandra.embedded.working-directory-resources.[conf/cassandra.yaml]=classpath:cassandra.yaml
For more advanced builder customizations, you can register an arbitrary number of beans that
implement CassandraBuilderConfigurator
.
@Configuration(proxyBeanMethods = false)
static class CassandraBuilderConfigurators {
@Bean
CassandraBuilderConfigurator cassandraBuilderConfigurator() {
return new CassandraBuilderConfigurator() {
@Override
public void configure(CassandraBuilder builder) {
//
}
};
}
}
You also can register your own CassandraBuilder
bean to get a full control of Cassandra
bean instantiation.
@Configuration(proxyBeanMethods = false)
static class CassandraBuilderConfiguration {
@Bean
@Scope("prototype")
CassandraBuilder cassandraBuilder() {
CassandraBuilder builder = new CassandraBuilder();
//configure builder
return builder;
}
}
EmbeddedCassandraAutoConfiguration
can be easily used with @DataCassandraTest
annotation for testing Cassandra
repositories, just add @ImportAutoConfiguration(EmbeddedCassandraAutoConfiguration.class)
to your test.
@DataCassandraTest
@ImportAutoConfiguration(EmbeddedCassandraAutoConfiguration.class)
class CassandraRepositoriesTest {
//
}
Embedded Cassandra [Spring Boot Starter] does not support CQL script migration, for this purpose you may try to use the following projects:
<dependencies>
<dependency>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra-spring-boot-starter</artifactId>
<version>4.1.1</version>
</dependency>
</dependencies>
For other build tools, please use the following link
Embedded Cassandra [Spring Boot Starter]
uses GitHub's issue tracking system to report bugs and feature requests. If
you want to raise an issue, please follow
this link
and use predefined GitHub
templates.
Also see CONTRIBUTING.md if you wish to submit pull requests.
Embedded Cassandra [Spring Boot Starter]
can be easily built with
the maven wrapper. You also need JDK 1.8
.
$ ./mvnw clean verify
This project is released under the Apache License 2.0