Values in a spring.data.cassandra.config file can't override some defaults defined in CassandraProperties #31238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit changes two things:
Most primitives on
CassandraProperties
are replaced with object values. This allows distinguishing between default-values and no-values. ThenCassandraAutoConfiguration.mapConfig()
can usewhenNonNull()
predicate to ignore those.CassandraProperties
no longer populate default values that are overridable byspring.data.cassandra.config
file. This let the defaults to be applied on top of the filespring.data.cassandra.config
; i.e. the config file have higher precedence than the defaults, but lower that anyspring.data.cassandra.*
property.On the test side, the file
override-defaults.conf
is defined to override the values that were non-overridable with values which are different from the default.In this proposal, the
spring.data.cassandra.port
configuration has a bit rough behaviour:In case property
spring.data.cassandra.contact-points
is configured without a port - the value ofspring.data.cassandra.port
(which defaults to 9042) is used.Otherwise, in case
contact-points
onspring.data.cassandra.config
file are defined -- then the contact-points must be configured with a port (as the conf file provides no separate port property).Otherwise,
contact-points
defaults to127.0.0.1:9042
regardless ofspring.data.cassandra.port
configuration.Closes gh-31025