Skip to content

Commit 18f5025

Browse files
committed
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.
1 parent f311501 commit 18f5025

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/AbstractCassandraConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.context.annotation.Configuration;
2525
import org.springframework.core.convert.converter.Converter;
2626
import org.springframework.data.cassandra.SessionFactory;
27-
import org.springframework.data.cassandra.core.CassandraAdminOperations;
2827
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
2928
import org.springframework.data.cassandra.core.convert.CassandraConverter;
3029
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
@@ -196,7 +195,7 @@ protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException {
196195
* @throws Exception if the {@link com.datastax.driver.core.Session} could not be obtained.
197196
*/
198197
@Bean
199-
public CassandraAdminOperations cassandraTemplate() throws Exception {
198+
public CassandraAdminTemplate cassandraTemplate() throws Exception {
200199
return new CassandraAdminTemplate(sessionFactory(), cassandraConverter());
201200
}
202201

spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/AbstractReactiveCassandraConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.springframework.data.cassandra.ReactiveSession;
2020
import org.springframework.data.cassandra.ReactiveSessionFactory;
2121
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
22-
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
2322
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;
2423
import org.springframework.data.cassandra.core.cql.ReactiveCqlOperations;
2524
import org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate;
@@ -64,12 +63,12 @@ public ReactiveSessionFactory reactiveSessionFactory() {
6463
/**
6564
* Creates a {@link CassandraAdminTemplate}.
6665
*
67-
* @return the {@link ReactiveCassandraOperations}.
66+
* @return the {@link ReactiveCassandraTemplate}.
6867
* @see #reactiveSessionFactory()
6968
* @see #cassandraConverter()
7069
*/
7170
@Bean
72-
public ReactiveCassandraOperations reactiveCassandraTemplate() {
71+
public ReactiveCassandraTemplate reactiveCassandraTemplate() {
7372
return new ReactiveCassandraTemplate(reactiveSessionFactory(), cassandraConverter());
7473
}
7574

@@ -80,7 +79,7 @@ public ReactiveCassandraOperations reactiveCassandraTemplate() {
8079
* @see #reactiveSessionFactory()
8180
*/
8281
@Bean
83-
public ReactiveCqlOperations reactiveCqlTemplate() {
82+
public ReactiveCqlTemplate reactiveCqlTemplate() {
8483
return new ReactiveCqlTemplate(reactiveSessionFactory());
8584
}
8685
}

0 commit comments

Comments
 (0)