DATACASS-55: removed CassandraTemplate @Bean from AbstractCassandraTemplate
This commit is contained in:
@@ -67,11 +67,6 @@ public abstract class AbstractCassandraConfiguration {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraOperations template() throws Exception {
|
||||
return new CassandraTemplate(session().getObject());
|
||||
}
|
||||
|
||||
protected List<String> getStartupScripts() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -60,10 +60,12 @@ public abstract class AbstractSpringDataCassandraConfiguration extends AbstractC
|
||||
|
||||
/**
|
||||
* Creates a {@link CassandraAdminTemplate}.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Bean
|
||||
public CassandraAdminOperations adminTemplate() {
|
||||
return new CassandraAdminTemplate(session());
|
||||
public CassandraAdminOperations adminTemplate() throws Exception {
|
||||
return new CassandraAdminTemplate(session().getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package org.springframework.data.cassandra.test.integration.config;
|
||||
|
||||
import org.springframework.cassandra.config.CassandraSessionFactoryBean;
|
||||
import org.springframework.cassandra.core.CassandraOperations;
|
||||
import org.springframework.cassandra.core.CassandraTemplate;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.cassandra.config.java.AbstractSpringDataCassandraConfiguration;
|
||||
@@ -12,9 +9,6 @@ import org.springframework.data.cassandra.core.CassandraDataOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraDataTemplate;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
|
||||
import com.datastax.driver.core.Cluster;
|
||||
import com.datastax.driver.core.Cluster.Builder;
|
||||
|
||||
/**
|
||||
* Setup any spring configuration for unit tests
|
||||
*
|
||||
@@ -31,47 +25,13 @@ public class TestConfig extends AbstractSpringDataCassandraConfiguration {
|
||||
return keyspaceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public Cluster cluster() {
|
||||
|
||||
Builder builder = Cluster.builder();
|
||||
builder.addContactPoint("127.0.0.1").withPort(9042);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraSessionFactoryBean sessionFactoryBean() {
|
||||
|
||||
CassandraSessionFactoryBean bean = new CassandraSessionFactoryBean();
|
||||
bean.setCluster(cluster());
|
||||
bean.setKeyspaceName(getKeyspaceName());
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraOperations cassandraTemplate() {
|
||||
|
||||
CassandraOperations template = new CassandraTemplate(sessionFactoryBean().getObject());
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraConverter cassandraConverter() {
|
||||
|
||||
CassandraConverter converter = new MappingCassandraConverter(new CassandraMappingContext());
|
||||
|
||||
return converter;
|
||||
|
||||
return new MappingCassandraConverter(new CassandraMappingContext());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraDataOperations cassandraDataTemplate() throws ClassNotFoundException {
|
||||
|
||||
CassandraDataOperations template = new CassandraDataTemplate(sessionFactoryBean().getObject(), converter(),
|
||||
keyspaceName);
|
||||
|
||||
return template;
|
||||
|
||||
public CassandraDataOperations cassandraDataTemplate() throws Exception {
|
||||
return new CassandraDataTemplate(session().getObject(), converter(), keyspaceName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user