Skip to content

CassandraAutoConfiguration should not be triggered solely by presence of CqlSession class #46400

@renatomameli

Description

@renatomameli

Currently, Spring Boot’s CassandraAutoConfiguration activates automatically as soon as the class com.datastax.oss.driver.api.core.CqlSession is present on the classpath. See org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration

This behavior causes unintended activation in cases where:

  • The Cassandra driver is included as a runtime dependency (e.g. implementation or runtimeOnly),
  • But Cassandra is not actually configured or intended to be used in the running application.

This can lead to unexpected auto-configuration and sometimes startup failures. While it is possible to disable the configuration via application properties, I believe this should not be the default behavior.

For example, it would be beneficial to require an explicit property (e.g., spring.data.cassandra.enabled=true) in addition to the presence of CqlSession to activate the auto-configuration.

If desired, I can help prepare a pull request or refine this further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions