diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessor.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessor.java
deleted file mode 100644
index 752ed83b7..000000000
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessor.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2013-2020 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.cassandra.config;
-
-import static org.springframework.data.cassandra.config.BeanDefinitionUtils.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.ListableBeanFactory;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.data.cassandra.core.CassandraOperations;
-import org.springframework.data.cassandra.core.CassandraTemplate;
-import org.springframework.data.cassandra.core.convert.CassandraConverter;
-import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
-import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
-import org.springframework.util.StringUtils;
-
-import com.datastax.oss.driver.api.core.session.Session;
-
-/**
- * {@link BeanFactoryPostProcessor} that does its best to register any missing Spring Data Cassandra beans that can be
- * defaulted. Specifically, it attempts to create default bean definitions for the following required interface types
- * via their default implementation types:
- *
- * - {@link CassandraOperations} via {@link CassandraTemplate}
- * - {@link CassandraMappingContext} via {@link CassandraMappingContext}
- * - {@link CassandraConverter} via {@link MappingCassandraConverter}
- *
- *
- * If there are multiple definitions for any type that another type depends on, an {@link IllegalStateException} is
- * thrown. For example, if there are two definitions for type {@link CassandraMappingContext} present and no definition
- * for type {@link CassandraConverter}, then it's impossible to know which {@link CassandraMappingContext} is to be used
- * when creating a default definition for the {@link CassandraConverter}.
- *
- * If a single definition of a required type is present, then it is used. For example, if there is already a
- * {@link CassandraMappingContext} definition present, then it will be used in the {@link CassandraMappingContext} bean
- * definition.
- *
- * It requires that a single {@link com.datastax.oss.driver.api.core.CqlSession} or {@link CassandraSessionFactoryBean}
- * definition be present. As described above, multiple {@link com.datastax.oss.driver.api.core.CqlSession} definitions,
- * multiple {@link CassandraSessionFactoryBean} definitions, or both a
- * {@link com.datastax.oss.driver.api.core.CqlSession} and {@link CassandraSessionFactoryBean} will cause an
- * {@link IllegalStateException} to be thrown.
- *
- * @author Matthew T. Adams
- * @author Mark Paluch
- * @author Mateusz Szymczak
- * @deprecated Will be removed with the next major release. Spring Data Cassandra is not the best place to apply
- * configuration defaults.
- */
-@Deprecated
-public class CassandraMappingBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
-
- /**
- * Ensures that {@link BeanDefinition}s for a {@link CassandraMappingContext} and a {@link CassandraConverter} exist.
- */
- @Override
- public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException {
-
- if (!(factory instanceof BeanDefinitionRegistry)) {
- return;
- }
-
- registerMissingDefaultableBeanDefinitions((BeanDefinitionRegistry) factory, factory);
- }
-
- private void registerMissingDefaultableBeanDefinitions(BeanDefinitionRegistry registry, ListableBeanFactory factory) {
-
- // see if any template definitions exist, which requires a converter, which requires a mapping context
- BeanDefinitionHolder[] templateBeans = getBeanDefinitionsOfType(registry, factory, CassandraOperations.class, true,
- true);
-
- if (templateBeans.length >= 1) {
- return;
- }
-
- // need a session & converter for the default template
- // see if an actual Session definition exists
- String sessionBeanName = findSessionBeanName(registry, factory);
-
- // see if any converter bean definitions exist, which requires a mapping context
- BeanDefinitionHolder[] converterBeans = getBeanDefinitionsOfType(registry, factory, MappingCassandraConverter.class,
- true, false);
-
- if (converterBeans.length > 1) {
- throw createAmbiguousBeansException(converterBeans.length, CassandraConverter.class, CassandraTemplate.class);
- }
-
- if (converterBeans.length == 1) {
- registerDefaultTemplate(registry, sessionBeanName, converterBeans[0].getBeanName());
- return;
- }
-
- // see if any mapping context bean definitions exist
- BeanDefinitionHolder[] contextBeans = getBeanDefinitionsOfType(registry, factory, CassandraMappingContext.class,
- true, false);
-
- if (contextBeans.length > 1) {
- // then throw, because we need to create a default converter, but we wouldn't know which mapping context to use
- throw createAmbiguousBeansException(contextBeans.length, MappingCassandraConverter.class,
- CassandraMappingContext.class);
- }
-
- // create the mapping context if necessary
- BeanDefinitionHolder contextBean = contextBeans.length == 1 ? contextBeans[0] : registerDefaultContext(registry);
-
- // create the default converter & template bean definitions
- BeanDefinitionHolder converter = registerDefaultConverter(registry, contextBean.getBeanName());
- registerDefaultTemplate(registry, sessionBeanName, converter.getBeanName());
- }
-
- private String findSessionBeanName(BeanDefinitionRegistry registry, ListableBeanFactory factory) {
-
- // first, search for any session and session factory beans
- BeanDefinitionHolder[] sessionBeans = getBeanDefinitionsOfType(registry, factory, Session.class, true, true);
-
- if (sessionBeans.length == 1) { // can't create default template -- none or multiple
- return sessionBeans[0].getBeanName();
- }
-
- throw createAmbiguousBeansException(sessionBeans.length, CassandraTemplate.class, Session.class,
- CassandraSessionFactoryBean.class);
- }
-
- private IllegalStateException createAmbiguousBeansException(int beanDefinitionCount, Class> defaultBeanType,
- Class>... types) {
-
- return new IllegalStateException(
- String.format("found %d beans of type%s [%s] - %s for creation of default [%s]", beanDefinitionCount,
- beanDefinitionCount == 1 ? "" : "s", StringUtils.collectionToCommaDelimitedString(getNames(types)),
- beanDefinitionCount == 0 ? "need exactly one" : "can't disambiguate", defaultBeanType.getName()));
- }
-
- private BeanDefinitionHolder registerDefaultContext(BeanDefinitionRegistry registry) {
-
- BeanDefinitionHolder contextBean = new BeanDefinitionHolder(
- BeanDefinitionBuilder.genericBeanDefinition(CassandraMappingContext.class).getBeanDefinition(),
- DefaultBeanNames.CONTEXT);
-
- registry.registerBeanDefinition(contextBean.getBeanName(), contextBean.getBeanDefinition());
-
- return contextBean;
- }
-
- private BeanDefinitionHolder registerDefaultConverter(BeanDefinitionRegistry registry, String contextBeanName) {
-
- BeanDefinition beanDefinition = BeanDefinitionBuilder //
- .genericBeanDefinition(MappingCassandraConverter.class) //
- .addConstructorArgReference(contextBeanName).getBeanDefinition();
-
- BeanDefinitionHolder converter = new BeanDefinitionHolder(beanDefinition, DefaultBeanNames.CONVERTER);
- registry.registerBeanDefinition(converter.getBeanName(), converter.getBeanDefinition());
-
- return converter;
- }
-
- private void registerDefaultTemplate(BeanDefinitionRegistry registry, String sessionBeanName,
- String converterBeanName) {
-
- BeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(CassandraTemplate.class) //
- .addConstructorArgReference(sessionBeanName) //
- .addConstructorArgReference(converterBeanName) //
- .getBeanDefinition();
-
- BeanDefinitionHolder template = new BeanDefinitionHolder(beanDefinition, DefaultBeanNames.DATA_TEMPLATE);
- registry.registerBeanDefinition(template.getBeanName(), template.getBeanDefinition());
- }
-
- private Collection getNames(Class>[] types) {
-
- List names = new ArrayList<>();
-
- for (Class> type : types) {
- names.add(type.getName());
- }
-
- return names;
- }
-}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingContextParser.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingContextParser.java
index 85fb5c8cd..c70d2b34b 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingContextParser.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingContextParser.java
@@ -70,9 +70,6 @@ class CassandraMappingContextParser extends AbstractSingleBeanDefinitionParser {
*/
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
-
- CassandraMappingXmlBeanFactoryPostProcessorRegistrar.ensureRegistration(element, parserContext);
-
parseMapping(element, builder);
}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingConverterParser.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingConverterParser.java
index 17d59b7ae..7b6dda5f5 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingConverterParser.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingConverterParser.java
@@ -57,8 +57,6 @@ class CassandraMappingConverterParser extends AbstractSingleBeanDefinitionParser
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- CassandraMappingXmlBeanFactoryPostProcessorRegistrar.ensureRegistration(element, parserContext);
-
String mappingRef = element.getAttribute("mapping-ref");
if (!StringUtils.hasText(mappingRef)) {
mappingRef = DefaultBeanNames.CONTEXT;
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingXmlBeanFactoryPostProcessorRegistrar.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingXmlBeanFactoryPostProcessorRegistrar.java
deleted file mode 100644
index 79ac0a7d6..000000000
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraMappingXmlBeanFactoryPostProcessorRegistrar.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2013-2020 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.cassandra.config;
-
-import org.springframework.beans.factory.BeanFactoryUtils;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.data.config.BeanComponentDefinitionBuilder;
-import org.w3c.dom.Element;
-
-/**
- * Ensures that a {@link CassandraMappingBeanFactoryPostProcessor} is registered.
- *
- * @author Matthew T. Adams
- * @author Mark Paluch
- */
-@Deprecated
-class CassandraMappingXmlBeanFactoryPostProcessorRegistrar {
-
- /**
- * Ensures that a {@link CassandraMappingBeanFactoryPostProcessor} is registered. This method is a no-op if one is
- * already registered.
- */
- static void ensureRegistration(Element element, ParserContext parserContext) {
-
- BeanDefinitionRegistry registry = parserContext.getRegistry();
- if (!(registry instanceof GenericApplicationContext)) {
- return;
- }
- ConfigurableListableBeanFactory factory = ((GenericApplicationContext) registry).getBeanFactory();
-
- String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(factory,
- CassandraMappingBeanFactoryPostProcessor.class, true, false);
- if (names.length > 0) {
- return;
- }
-
- BeanComponentDefinitionBuilder componentBuilder = new BeanComponentDefinitionBuilder(element, parserContext);
- BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
- .genericBeanDefinition(CassandraMappingBeanFactoryPostProcessor.class);
-
- parserContext.registerBeanComponent(componentBuilder.getComponent(definitionBuilder));
- }
-}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraTemplateParser.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraTemplateParser.java
index 8dfcb19b3..b895f33f0 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraTemplateParser.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/config/CassandraTemplateParser.java
@@ -59,8 +59,6 @@ class CassandraTemplateParser extends AbstractSingleBeanDefinitionParser {
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- CassandraMappingXmlBeanFactoryPostProcessorRegistrar.ensureRegistration(element, parserContext);
-
super.doParse(element, parserContext, builder);
if (element.hasAttribute("cql-template-ref")) {
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/session/DefaultBridgedReactiveSession.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/session/DefaultBridgedReactiveSession.java
index d4af92ab9..ba07c2427 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/session/DefaultBridgedReactiveSession.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/session/DefaultBridgedReactiveSession.java
@@ -84,19 +84,6 @@ public class DefaultBridgedReactiveSession implements ReactiveSession {
this.session = session;
}
- /**
- * Create a new {@link DefaultBridgedReactiveSession} for a {@link CqlSession} and {@link Scheduler}.
- *
- * @param session must not be {@literal null}.
- * @param scheduler must not be {@literal null}.
- * @deprecated since 2.1. Use {@link #DefaultBridgedReactiveSession(CqlSession)} as a {@link Scheduler} is no longer
- * required to off-load {@link AsyncResultSet}'s blocking behavior.
- */
- @Deprecated
- public DefaultBridgedReactiveSession(CqlSession session, Scheduler scheduler) {
- this(session);
- }
-
/* (non-Javadoc)
* @see org.springframework.data.cassandra.ReactiveSession#isClosed()
*/
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java
deleted file mode 100644
index 9ce804c8c..000000000
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/TypedIdCassandraRepository.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2013-2020 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.cassandra.repository;
-
-import org.springframework.data.cassandra.core.mapping.MapId;
-import org.springframework.data.cassandra.core.mapping.Table;
-import org.springframework.data.repository.NoRepositoryBean;
-
-/**
- * Cassandra-specific extension of the {@link CrudRepository} interface that allows the specification of a type for the
- * identity of the {@link Table @Table} (or {@link Persistable @Persistable}) type.
- *
- * If a single column comprises the identity of the entity, then you must do one of two things:
- *
- * - annotate the field or property in your entity with {@link PrimaryKey @PrimaryKey} and declare your repository
- * interface to be a subinterface of this interface, specifying the entity type and id type, or
- * - annotate the field or property in your entity with {@link PrimaryKeyColumn @PrimaryKeyColumn} and declare your
- * repository interface to be a subinterface of {@link MapIdCassandraRepository}.
- *
- * If multiple columns comprise the identity of the entity, then you must employ one of the following two strategies.
- *
- * - Strategy: use an explicit primary key class
- *
- * - Define a primary key class (annotated with {@link PrimaryKeyClass @PrimaryKeyClass}) that represents your
- * entity's identity.
- * - Define your entity to include a field or property of the type of your primary key class, and annotate that field
- * with {@link PrimaryKey @PrimaryKey}.
- * - Define your repository interface to be a subinterface of this interface, including your entity type and
- * your primary key class type.
- *
- * - Strategy: embed identity fields or properties directly in your entity and use
- * {@link MapIdCassandraRepository}
- *
- * - Define your entity, including a field or property for each column, including those for partition and (optional)
- * cluster columns.
- * - Annotate each partition & cluster field or property with {@link PrimaryKeyColumn @PrimaryKeyColumn}
- * - Define your repository interface to be a subinterface of {@link MapIdCassandraRepository}, which uses a provided
- * id type, {@link MapId} (implemented by {@link BasicMapId}).
- * - Whenever you need a {@link MapId}, you can use the static factory method {@link BasicMapId#id()} (which is
- * convenient if you import statically) and the builder method {@link MapId#with(String, Object)} to easily construct an
- * id.
- *
- *
- *
- * @author Alex Shvid
- * @author Matthew T. Adams
- * @author Mark Paluch
- * @deprecated since 2.0, use {@link CassandraRepository}.
- */
-@NoRepositoryBean
-@Deprecated
-public interface TypedIdCassandraRepository extends CassandraRepository {}
diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
index e346f0887..b81a3bcb6 100644
--- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
+++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/repository/support/SimpleCassandraRepository.java
@@ -110,19 +110,6 @@ public class SimpleCassandraRepository implements CassandraRepository Insert createInsert(S entity) {
- return InsertUtil.createInsert(this.operations.getConverter(), entity);
- }
-
/* (non-Javadoc)
* @see org.springframework.data.cassandra.repository.TypedIdCassandraRepository#insert(java.lang.Object)
*/
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessorUnitTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessorUnitTests.java
deleted file mode 100644
index 516739291..000000000
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/config/CassandraMappingBeanFactoryPostProcessorUnitTests.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2016-2020 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.cassandra.config;
-
-import static org.assertj.core.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
-import org.junit.Test;
-
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.beans.factory.config.AbstractFactoryBean;
-import org.springframework.context.support.GenericXmlApplicationContext;
-import org.springframework.data.cassandra.core.CassandraOperations;
-import org.springframework.data.cassandra.core.convert.CassandraConverter;
-import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
-
-import com.datastax.oss.driver.api.core.CqlSession;
-
-/**
- * Unit tests for {@link CassandraMappingBeanFactoryPostProcessor}.
- *
- * @author Mark Paluch
- * @author Mateusz Szymczak
- */
-public class CassandraMappingBeanFactoryPostProcessorUnitTests {
-
- @Test // DATACASS-290, DATACASS-401
- public void MappingAndConverterRegistrationTriggersDefaultBeanRegistration() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "mock-session-mapping-converter.xml");
- context.refresh();
-
- assertThat(context.getBeanNamesForType(CassandraOperations.class)).contains(DefaultBeanNames.DATA_TEMPLATE);
- }
-
- @Test // DATACASS-290
- public void converterRegistrationFailsDueToMissingCassandraMapping() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "mock-session-converter.xml");
-
- assertThatExceptionOfType(BeanCreationException.class).isThrownBy(context::refresh)
- .withMessageContaining("No bean named 'cassandraMapping'");
- }
-
- @Test // DATACASS-290
- public void shouldNotFailFailWithMultipleSessions() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "multiple-sessions.xml");
-
- context.refresh();
-
- assertThat(context.getBeanNamesForType(CqlSession.class)).hasSize(2);
- }
-
- @Test // DATACASS-290
- public void defaultBeanRegistrationShouldFailWithMultipleMappingContexts() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "multiple-mapping-contexts.xml");
-
- assertThatIllegalStateException().isThrownBy(context::refresh).withMessageContaining("found 2 beans of type")
- .withMessageContaining("CassandraMappingContext");
- }
-
- @Test // DATACASS-290
- public void defaultBeanRegistrationShouldFailWithMultipleConvertersContexts() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "multiple-converters.xml");
-
- assertThatIllegalStateException().isThrownBy(context::refresh).withMessageContaining("found 2 beans of type")
- .withMessageContaining("CassandraConverter");
- }
-
- @Test // DATACASS-290
- public void shouldAllowTwoKeyspaces() {
-
- GenericXmlApplicationContext context = new GenericXmlApplicationContext();
- context.load(CassandraMappingBeanFactoryPostProcessorUnitTests.class, "two-keyspaces-namespace.xml");
- context.refresh();
-
- assertThat(context.getBeanNamesForType(CassandraOperations.class)).containsExactly("c-1", "c-2");
- assertThat(context.getBeanNamesForType(CassandraMappingContext.class)).containsExactly("mapping-1", "mapping-2");
- assertThat(context.getBeanNamesForType(CassandraConverter.class)).containsExactly("converter-1", "converter-2");
- }
-
- @SuppressWarnings("unused")
- private static class MockSessionFactory extends AbstractFactoryBean {
-
- @Override
- public Class> getObjectType() {
- return CqlSession.class;
- }
-
- @Override
- protected CqlSession createInstance() {
- return mock(CqlSession.class);
- }
- }
-}
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/ReactiveCassandraTemplateIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/ReactiveCassandraTemplateIntegrationTests.java
index fad7ccd39..a154e78e1 100644
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/ReactiveCassandraTemplateIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/ReactiveCassandraTemplateIntegrationTests.java
@@ -57,7 +57,7 @@ public class ReactiveCassandraTemplateIntegrationTests extends AbstractKeyspaceC
MappingCassandraConverter converter = new MappingCassandraConverter();
CassandraTemplate cassandraTemplate = new CassandraTemplate(this.session, converter);
- DefaultBridgedReactiveSession session = new DefaultBridgedReactiveSession(this.session, Schedulers.elastic());
+ DefaultBridgedReactiveSession session = new DefaultBridgedReactiveSession(this.session);
template = new ReactiveCassandraTemplate(new ReactiveCqlTemplate(session), converter);
diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/DefaultBridgedReactiveSessionIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/DefaultBridgedReactiveSessionIntegrationTests.java
index d2b8380ba..14d51b846 100644
--- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/DefaultBridgedReactiveSessionIntegrationTests.java
+++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/DefaultBridgedReactiveSessionIntegrationTests.java
@@ -45,7 +45,7 @@ public class DefaultBridgedReactiveSessionIntegrationTests extends AbstractKeysp
this.session.execute("DROP TABLE IF EXISTS users;");
- this.reactiveSession = new DefaultBridgedReactiveSession(this.session, Schedulers.elastic());
+ this.reactiveSession = new DefaultBridgedReactiveSession(this.session);
}
@Test // DATACASS-335
diff --git a/src/main/asciidoc/reference/migration-guide-2.2-to-3.0.adoc b/src/main/asciidoc/reference/migration-guide-2.2-to-3.0.adoc
index 099b52ed3..2b8297a64 100644
--- a/src/main/asciidoc/reference/migration-guide-2.2-to-3.0.adoc
+++ b/src/main/asciidoc/reference/migration-guide-2.2-to-3.0.adoc
@@ -53,6 +53,9 @@ With the upgrade, schema support was moved to a new namespace element: `cassandr
----
====
+NOTE: Spring Data Cassandra 3.0 no longer registers default Mapping Context, Context and Template API beans when using XML namespace configuration.
+The defaulting should be applied on application or Spring Boot level.
+
== Template API
Spring Data for Apache Cassandra encapsulates most of the changes that come with the driver upgrade as the Template API and repository support if your application mainly interacts with mapped entities or primitive Java types.
@@ -188,6 +191,8 @@ Use execution profiles as replacement.
* `cql` namespace (`http://www.springframework.org/schema/cql`, use `http://www.springframework.org/schema/data/cassandra` instead)
* `cassandra:cluster` (endpoint properties merged to `cassandra:session`)
* `cql:template`, use `cassandra:cql-template` instead
+* Removed implicit bean registrations Mapping Context, Context and Template API beans.
+These must be declared explicitly.
== Additions