Description
org.springframework.data.cassandra.config.CqlSessionFactoryBean
implements PersistenceExceptionTranslator
that means that on each RuntimeException PersistenceExceptionTranslationInterceptor
will find the bean for class CqlSessionFactoryBean
to try translate the exception. If Cassandra is not available getBean
method will fail with BeanCreationException
because CqlSessionFactoryBean
tried to connect to Cassandra and failed.
Expected behavior is that Spring will find a bean for class org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator
and try to translate RuntimeException using this bean, instead of trying to create a new object of CqlSessionFactoryBean
.
A possible solution is to remove implements PersistenceExceptionTranslator
from CqlSessionFactoryBean
.