DATACASS-600 - Use template implementation classes as bean type in configuration support.

cassandraTemplate(…) and cqlTemplate(…) bean methods now use the template implementation class as their return type to provide the most specific type information for the bean declaration.

Previously, we declared the bean type using their interface which made it impossible to resolve beans using the template class.
This commit is contained in:
Mark Paluch
2018-10-12 15:06:26 +02:00
parent f3115017d4
commit 18f5025e64
2 changed files with 4 additions and 6 deletions

View File

@@ -24,7 +24,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.cassandra.SessionFactory;
import org.springframework.data.cassandra.core.CassandraAdminOperations;
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
@@ -196,7 +195,7 @@ public abstract class AbstractCassandraConfiguration extends AbstractClusterConf
* @throws Exception if the {@link com.datastax.driver.core.Session} could not be obtained.
*/
@Bean
public CassandraAdminOperations cassandraTemplate() throws Exception {
public CassandraAdminTemplate cassandraTemplate() throws Exception {
return new CassandraAdminTemplate(sessionFactory(), cassandraConverter());
}

View File

@@ -19,7 +19,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.data.cassandra.ReactiveSession;
import org.springframework.data.cassandra.ReactiveSessionFactory;
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;
import org.springframework.data.cassandra.core.cql.ReactiveCqlOperations;
import org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate;
@@ -64,12 +63,12 @@ public abstract class AbstractReactiveCassandraConfiguration extends AbstractCas
/**
* Creates a {@link CassandraAdminTemplate}.
*
* @return the {@link ReactiveCassandraOperations}.
* @return the {@link ReactiveCassandraTemplate}.
* @see #reactiveSessionFactory()
* @see #cassandraConverter()
*/
@Bean
public ReactiveCassandraOperations reactiveCassandraTemplate() {
public ReactiveCassandraTemplate reactiveCassandraTemplate() {
return new ReactiveCassandraTemplate(reactiveSessionFactory(), cassandraConverter());
}
@@ -80,7 +79,7 @@ public abstract class AbstractReactiveCassandraConfiguration extends AbstractCas
* @see #reactiveSessionFactory()
*/
@Bean
public ReactiveCqlOperations reactiveCqlTemplate() {
public ReactiveCqlTemplate reactiveCqlTemplate() {
return new ReactiveCqlTemplate(reactiveSessionFactory());
}
}