Permalink
Browse files

DATACASS-600 - Use template implementation classes as bean type in co…

…nfiguration 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.
  • Loading branch information...
mp911de committed Oct 12, 2018
1 parent f311501 commit 18f5025e6444c9e3b804da561c38f17596409b2c
@@ -24,7 +24,6 @@
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 CustomConversions customConversions() {
* @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());
}
@@ -19,7 +19,6 @@
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 ReactiveSessionFactory reactiveSessionFactory() {
/**
* 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 ReactiveCassandraOperations reactiveCassandraTemplate() {
* @see #reactiveSessionFactory()
*/
@Bean
public ReactiveCqlOperations reactiveCqlTemplate() {
public ReactiveCqlTemplate reactiveCqlTemplate() {
return new ReactiveCqlTemplate(reactiveSessionFactory());
}
}

0 comments on commit 18f5025

Please sign in to comment.