Skip to content

Commit 305d07a

Browse files
committed
Remove PersistenceExceptionTranslator from CqlSessionFactoryBean.
Revise design and do not couple exception translation to the factory bean to avoid undesired instantiation (and connectivity requirements) towards Cassandra. Closes #1179
1 parent c91325f commit 305d07a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
import org.apache.commons.logging.Log;
3232
import org.apache.commons.logging.LogFactory;
3333
import org.jspecify.annotations.Nullable;
34+
3435
import org.springframework.beans.factory.DisposableBean;
3536
import org.springframework.beans.factory.FactoryBean;
3637
import org.springframework.beans.factory.InitializingBean;
3738
import org.springframework.dao.DataAccessException;
38-
import org.springframework.dao.support.PersistenceExceptionTranslator;
3939
import org.springframework.data.cassandra.core.CassandraAdminOperations;
4040
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
4141
import org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaCreator;
@@ -72,7 +72,7 @@
7272
* @since 3.0
7373
*/
7474
public class CqlSessionFactoryBean
75-
implements FactoryBean<CqlSession>, InitializingBean, DisposableBean, PersistenceExceptionTranslator {
75+
implements FactoryBean<CqlSession>, InitializingBean, DisposableBean {
7676

7777
public static final String CASSANDRA_SYSTEM_SESSION = "system";
7878
public static final String DEFAULT_CONTACT_POINTS = "localhost";
@@ -674,7 +674,13 @@ public Class<? extends CqlSession> getObjectType() {
674674
return CqlSession.class;
675675
}
676676

677-
@Override
677+
/**
678+
* @param e
679+
* @return
680+
* @deprecated since 5.0, use {@link CassandraExceptionTranslator#translateExceptionIfPossible(RuntimeException)}
681+
* directly.
682+
*/
683+
@Deprecated(since = "5.0", forRemoval = true)
678684
public @Nullable DataAccessException translateExceptionIfPossible(RuntimeException e) {
679685
return EXCEPTION_TRANSLATOR.translateExceptionIfPossible(e);
680686
}

0 commit comments

Comments
 (0)