Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,6 +45,8 @@
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
import org.springframework.data.cassandra.core.cql.CqlOperations;
import org.springframework.data.cassandra.core.cql.CqlTemplate;
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver;

Expand Down Expand Up @@ -120,6 +122,12 @@ public CassandraTemplate cassandraTemplate(SessionFactory sessionFactory, Cassan
return new CassandraTemplate(sessionFactory, converter);
}

@Bean
@ConditionalOnMissingBean(CqlOperations.class)
public CqlTemplate cqlTemplate(SessionFactory sessionFactory) {
return new CqlTemplate(sessionFactory);
}

@Bean
@ConditionalOnMissingBean
public CassandraCustomConversions cassandraCustomConversions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,8 @@
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.cql.ReactiveCqlOperations;
import org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate;
import org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession;
import org.springframework.data.cassandra.core.cql.session.DefaultReactiveSessionFactory;

Expand Down Expand Up @@ -65,4 +67,10 @@ public ReactiveCassandraTemplate reactiveCassandraTemplate(ReactiveSession react
return new ReactiveCassandraTemplate(reactiveCassandraSession, converter);
}

@Bean
@ConditionalOnMissingBean(ReactiveCqlOperations.class)
public ReactiveCqlTemplate reactiveCqlTemplate(ReactiveSessionFactory reactiveCassandraSessionFactory) {
return new ReactiveCqlTemplate(reactiveCassandraSessionFactory);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,6 +33,7 @@
import org.springframework.data.cassandra.core.CassandraTemplate;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
import org.springframework.data.cassandra.core.cql.CqlTemplate;
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver;
import org.springframework.data.domain.ManagedTypes;
Expand Down Expand Up @@ -65,6 +66,12 @@ void templateExists() {
assertThat(this.context.getBeanNamesForType(CassandraTemplate.class)).hasSize(1);
}

@Test
void cqlTemplateExists() {
load(CassandraMockConfiguration.class);
assertThat(this.context.getBeanNamesForType(CqlTemplate.class)).hasSize(1);
}

@Test
void entityScanShouldSetManagedTypes() {
load(EntityScanConfig.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;
import org.springframework.data.cassandra.core.convert.CassandraConverter;
import org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate;
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver;
import org.springframework.data.domain.ManagedTypes;
Expand Down Expand Up @@ -58,6 +59,12 @@ void templateExists() {
assertThat(this.context.getBeanNamesForType(ReactiveCassandraTemplate.class)).hasSize(1);
}

@Test
void reactiveCqlTemplateExists() {
load("spring.cassandra.keyspaceName:boot_test");
assertThat(this.context.getBeanNamesForType(ReactiveCqlTemplate.class)).hasSize(1);
}

@Test
void entityScanShouldSetManagedTypes() {
load(EntityScanConfig.class, "spring.cassandra.keyspaceName:boot_test");
Expand Down