diff --git a/zipkin-server/pom.xml b/zipkin-server/pom.xml
index ced5c0b9b56..c22e3e8d1e5 100644
--- a/zipkin-server/pom.xml
+++ b/zipkin-server/pom.xml
@@ -79,12 +79,14 @@
${project.groupId}
spanstore-cassandra
+ true
${project.groupId}
spanstore-jdbc
+ true
diff --git a/zipkin-server/src/it/minimal-dependencies/pom.xml b/zipkin-server/src/it/minimal-dependencies/pom.xml
index 47c2bf71dcb..5f7e45f750e 100644
--- a/zipkin-server/src/it/minimal-dependencies/pom.xml
+++ b/zipkin-server/src/it/minimal-dependencies/pom.xml
@@ -22,7 +22,7 @@
io.zipkin.java
parent
- 0.7.1-SNAPSHOT
+ 0.8.1-SNAPSHOT
../../../..
diff --git a/zipkin-server/src/main/java/zipkin/server/ZipkinServerConfiguration.java b/zipkin-server/src/main/java/zipkin/server/ZipkinServerConfiguration.java
index 4e96a4889d1..886e4e89fd8 100644
--- a/zipkin-server/src/main/java/zipkin/server/ZipkinServerConfiguration.java
+++ b/zipkin-server/src/main/java/zipkin/server/ZipkinServerConfiguration.java
@@ -28,6 +28,7 @@
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -45,7 +46,6 @@
import zipkin.jdbc.JDBCSpanStore;
import zipkin.kafka.KafkaConfig;
import zipkin.kafka.KafkaTransport;
-import zipkin.server.ZipkinServerProperties.Store.Type;
import zipkin.server.brave.TraceWritesSpanStore;
@Configuration
@@ -56,16 +56,6 @@ public class ZipkinServerConfiguration {
@Autowired
ZipkinServerProperties server;
- @Autowired
- ZipkinCassandraProperties cassandra;
-
- @Autowired(required = false)
- DataSource datasource;
-
- @Autowired(required = false)
- @Qualifier("jdbcTraceListenerProvider")
- ExecuteListenerProvider listener;
-
@Bean
@ConditionalOnMissingBean(Codec.Factory.class)
Codec.Factory codecFactory() {
@@ -78,24 +68,10 @@ Sampler traceIdSampler(@Value("${zipkin.collector.sample-rate:1.0}") float rate)
return Sampler.create(rate);
}
- @Bean SpanStore spanStore() {
- if (datasource != null && server.getStore().getType() == Type.mysql) {
- return new JDBCSpanStore(datasource, new Settings().withRenderSchema(false), listener);
- } else if (server.getStore().getType() == Type.cassandra) {
- CassandraConfig config = new CassandraConfig.Builder()
- .keyspace(cassandra.getKeyspace())
- .contactPoints(cassandra.getContactPoints())
- .localDc(cassandra.getLocalDc())
- .maxConnections(cassandra.getMaxConnections())
- .ensureSchema(cassandra.isEnsureSchema())
- .username(cassandra.getUsername())
- .password(cassandra.getPassword())
- .spanTtl(cassandra.getSpanTtl())
- .indexTtl(cassandra.getIndexTtl()).build();
- return new CassandraSpanStore(config);
- } else {
- return new InMemorySpanStore();
- }
+ @Bean
+ @ConditionalOnMissingBean(SpanStore.class)
+ SpanStore spanStore() {
+ return new InMemorySpanStore();
}
@Configuration
@@ -119,6 +95,43 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {
}
}
+ @Configuration
+ @ConditionalOnProperty(name = "zipkin.store.type", havingValue = "mysql")
+ @ConditionalOnClass(name = "zipkin.jdbc.JDBCSpanStore")
+ static class JDBCConfiguration {
+
+ @Autowired(required = false)
+ DataSource datasource;
+
+ @Autowired(required = false)
+ @Qualifier("jdbcTraceListenerProvider")
+ ExecuteListenerProvider listener;
+
+ @Bean SpanStore jdbcSpanStore() {
+ return new JDBCSpanStore(datasource, new Settings().withRenderSchema(false), listener);
+ }
+ }
+
+ @Configuration
+ @EnableConfigurationProperties(ZipkinCassandraProperties.class)
+ @ConditionalOnProperty(name = "zipkin.store.type", havingValue = "cassandra")
+ @ConditionalOnClass(name = "zipkin.cassandra.CassandraSpanStore")
+ static class CassandraConfiguration {
+ @Bean SpanStore cassandraSpanStore(ZipkinCassandraProperties cassandra) {
+ CassandraConfig config = new CassandraConfig.Builder()
+ .keyspace(cassandra.getKeyspace())
+ .contactPoints(cassandra.getContactPoints())
+ .localDc(cassandra.getLocalDc())
+ .maxConnections(cassandra.getMaxConnections())
+ .ensureSchema(cassandra.isEnsureSchema())
+ .username(cassandra.getUsername())
+ .password(cassandra.getPassword())
+ .spanTtl(cassandra.getSpanTtl())
+ .indexTtl(cassandra.getIndexTtl()).build();
+ return new CassandraSpanStore(config);
+ }
+ }
+
/**
* This transport consumes a topic, decodes spans from thrift messages and stores them subject to
* sampling policy.