Motivation:

It is possible to use CassandraAutoConfiguration to create CqlSession beans in an application with just a dependency on the DataStax Java driver, without the requirement to also depend on Spring Data Cassandra.

However, it is currently not possible to do so if the application also needs to create Actuator components. Indeed, both CassandraHealthIndicator and CassandraReactiveHealthContributorAutoConfiguration have a hard dependency on Spring Data Cassandra and its CassandraOperations bean.

Modifications:

This commit removes the hard dependency on Spring Data Cassandra from CassandraHealthIndicator and CassandraReactiveHealthContributorAutoConfiguration, and replaces all usages of CassandraOperations with direct access to the underlying CqlSession bean.

Result:

Users are now able to create Actuator health components in their applications, even if they use just Spring Boot and the DataStax Java driver, without Spring Data Cassandra.

Comment From: snicoll

We don't want to break backward compatible for this one. This should be possible by keeping the existing health indicator, adding this one and updating the auto-configuration to try this one and then the existing one if none apply. Unfortunately, the existing health indicator is in the cassandra package so we can't really have an additional one without having to use a name we wouldn't like. We've discovered brainstorming on this one that #11574 could be extended to package space as well as the actuator has no notion of data vs. raw driver.

It is unfortunately too late to make a breaking change in 2.3.x so I've scheduled this for the next feature release.

Comment From: adutra

I understand your concerns. I will rework this PR in the way you suggested, and should have something ready shortly. If you don't mind, since we are back to square zero anyway, I will rebase on master and squash the commits.

Comment From: adutra

What do you suggest for class names?

I'm currently planning on declaring all health indicators under org.springframework.boot.actuate.cassandra and naming the new ones:

  • CassandraDriverHealthIndicator
  • CassandraDriverReactiveHealthIndicator

Is that ok?

Comment From: philwebb

@adutra Those names sound sensible to me. We can always refine them if we think of something better when we merge.

Comment From: snicoll

Thanks @adutra. I've merged your contribution with a polish commit.

Comment From: snicoll

For the record, we've decided to deprecate the health indicators that rely on Spring Data (see #23226).