Harmonize data configuration

Any classes that rely on Spring Data being on the classpath
have been moved under a data package.

Certain configuration properties have also been updated to
accurately reflect whether Spring Data is required for the
auto-configuration to work.

Closes gh-11574
This commit is contained in:
Madhura Bhave
2022-05-05 15:45:42 -07:00
parent 1af5994d8f
commit 0991bd3983
65 changed files with 836 additions and 303 deletions

View File

@@ -685,7 +685,7 @@ with the `key` listed in the following table:
| Checks that a mail server is up.
| `mongo`
| {spring-boot-actuator-module-code}/mongo/MongoHealthIndicator.java[`MongoHealthIndicator`]
| {spring-boot-actuator-module-code}/data/mongo/MongoHealthIndicator.java[`MongoHealthIndicator`]
| Checks that a Mongo database is up.
| `neo4j`
@@ -701,7 +701,7 @@ with the `key` listed in the following table:
| Checks that a Rabbit server is up.
| `redis`
| {spring-boot-actuator-module-code}/redis/RedisHealthIndicator.java[`RedisHealthIndicator`]
| {spring-boot-actuator-module-code}/data/redis/RedisHealthIndicator.java[`RedisHealthIndicator`]
| Checks that a Redis server is up.
|===
@@ -833,11 +833,11 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Couchbase cluster is up.
| `elasticsearch`
| {spring-boot-actuator-module-code}/elasticsearch/ElasticsearchReactiveHealthIndicator.java[`ElasticsearchReactiveHealthIndicator`]
| {spring-boot-actuator-module-code}/data/elasticsearch/ElasticsearchReactiveHealthIndicator.java[`ElasticsearchReactiveHealthIndicator`]
| Checks that an Elasticsearch cluster is up.
| `mongo`
| {spring-boot-actuator-module-code}/mongo/MongoReactiveHealthIndicator.java[`MongoReactiveHealthIndicator`]
| {spring-boot-actuator-module-code}/data/mongo/MongoReactiveHealthIndicator.java[`MongoReactiveHealthIndicator`]
| Checks that a Mongo database is up.
| `neo4j`
@@ -845,7 +845,7 @@ When appropriate, Spring Boot auto-configures the following `ReactiveHealthIndic
| Checks that a Neo4j database is up.
| `redis`
| {spring-boot-actuator-module-code}/redis/RedisReactiveHealthIndicator.java[`RedisReactiveHealthIndicator`]
| {spring-boot-actuator-module-code}/data/redis/RedisReactiveHealthIndicator.java[`RedisReactiveHealthIndicator`]
| Checks that a Redis server is up.
|===

View File

@@ -326,17 +326,16 @@ There is a `spring-boot-starter-data-cassandra` "`Starter`" for collecting the d
[[data.nosql.cassandra.connecting]]
==== Connecting to Cassandra
You can inject an auto-configured `CassandraTemplate` or a Cassandra `CqlSession` instance as you would with any other Spring Bean.
The `spring.data.cassandra.*` properties can be used to customize the connection.
The `spring.cassandra.*` properties can be used to customize the connection.
Generally, you provide `keyspace-name` and `contact-points` as well the local datacenter name, as shown in the following example:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
data:
cassandra:
keyspace-name: "mykeyspace"
contact-points: "cassandrahost1:9042,cassandrahost2:9042"
local-datacenter: "datacenter1"
cassandra:
keyspace-name: "mykeyspace"
contact-points: "cassandrahost1:9042,cassandrahost2:9042"
local-datacenter: "datacenter1"
----
If the port is the same for all your contact points you can use a shortcut and only specify the host names, as shown in the following example:
@@ -344,22 +343,21 @@ If the port is the same for all your contact points you can use a shortcut and o
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
data:
cassandra:
keyspace-name: "mykeyspace"
contact-points: "cassandrahost1,cassandrahost2"
local-datacenter: "datacenter1"
cassandra:
keyspace-name: "mykeyspace"
contact-points: "cassandrahost1,cassandrahost2"
local-datacenter: "datacenter1"
----
TIP: Those two examples are identical as the port default to `9042`.
If you need to configure the port, use `spring.data.cassandra.port`.
If you need to configure the port, use `spring.cassandra.port`.
[NOTE]
====
The Cassandra driver has its own configuration infrastructure that loads an `application.conf` at the root of the classpath.
Spring Boot does not look for such a file by default but can load one using `spring.data.cassandra.config`.
If a property is both present in `+spring.data.cassandra.*+` and the configuration file, the value in `+spring.data.cassandra.*+` takes precedence.
Spring Boot does not look for such a file by default but can load one using `spring.cassandra.config`.
If a property is both present in `+spring.cassandra.*+` and the configuration file, the value in `+spring.cassandra.*+` takes precedence.
For more advanced driver customizations, you can register an arbitrary number of beans that implement `DriverConfigLoaderBuilderCustomizer`.
The `CqlSession` can be customized with a bean of type `CqlSessionBuilderCustomizer`.