-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CassandraAutoconfiguration leads to ignored parameters in db-config.conf #31025
Comments
@philwebb I can see you've flagged this as a bug but the current behavior is the expected behavior, see https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#data.nosql.cassandra.connecting. Perhaps the documentation should be more explicit that a default value counts as a value being present. @nilsvillwock the purpose of the config property is to let define properties that the Spring Boot namespace does not support. |
OK, please adjust the documentation from: If a property is both present in spring.data.cassandra.* and the configuration file, the value in spring.data.cassandra.* takes precedence. to: If a property is both present (even it is only by default) in spring.data.cassandra.* and the configuration file, the value in spring.data.cassandra.* takes precedence. |
We've discussed this at the team meeting and we come to realize that it was supposed to work as expected (see #24065). The problem is that some properties were overlooked, typically the ones that have a primitive type (and a default value of 0). @nilsvillwock it would be good to list the properties that you tried to define in |
@snicoll |
…ride defaults This commit changes two things: 1. Any primitive on CassandraProperties are replaced with object values. This allows distinguishing between defaults values and no-values. Then CassandraAutoConfiguration.mapConfig() can use whenNonNull() predicate to ignore those. 2. CassandraProperties no longer populate default values on any property. With that, the defaults can be applied on top of the file spring.data.cassandra.config; i.e. the config file have higher precedence than the defaults, but lower that any spring.data.cassandra.* property. Closes spring-projectsgh-31025
This commit changes two things: 1. Any primitive on CassandraProperties are replaced with object values. This allows distinguishing between defaults values and no-values. Then CassandraAutoConfiguration.mapConfig() can use whenNonNull() predicate to ignore those. 2. CassandraProperties no longer populate default values on any property. With that, the defaults can be applied on top of the file spring.data.cassandra.config; i.e. the config file have higher precedence than the defaults, but lower that any spring.data.cassandra.* property. Closes spring-projectsgh-31025
This commit changes two things: 1. Any primitive on CassandraProperties are replaced with object values. This allows distinguishing between defaults values and no-values. Then CassandraAutoConfiguration.mapConfig() can use whenNonNull() predicate to ignore those. 2. CassandraProperties no longer populate default values on any property. With that, the defaults can be applied on top of the file spring.data.cassandra.config; i.e. the config file have higher precedence than the defaults, but lower that any spring.data.cassandra.* property. Closes spring-projectsgh-31025
This commit changes two things: 1. Any primitive on CassandraProperties are replaced with object values. This allows distinguishing between defaults values and no-values. Then CassandraAutoConfiguration.mapConfig() can use whenNonNull() predicate to ignore those. 2. CassandraProperties no longer populate default values on any property. With that, the defaults can be applied on top of the file spring.data.cassandra.config; i.e. the config file have higher precedence than the defaults, but lower that any spring.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. Closes spring-projectsgh-31025
I looked into the issue, and started to write a solution. My general approach is here: ittays@f09e2b3 As I wrote there on the commit message, there are two changes required: one is removing primitives from It is still not complete, as introducing the nullable In addition, I'm not sure about where to locate the separated values. I defined a Last but not least, I found a significant flow which requires an additional thought: when Consider both cases when, say, system properties define the port and Today the |
Can you please look into my PR? |
@ittays there's no need to ask us to do that. The whole team already received a notification when you created the PR. |
We are using the cassandra driver specific configuration file
db-config.conf
via the property:The problem now is that even when I do not define further spring-boot
CassandraProperties
in the yaml, there are default values already set and these properties are ignored in thedb-config.conf
. file. The reason seem to be, because thedb-config.conf
properties are loaded as fallback after the default spring bootCassandraProperties
. Spring BootCassandraProperties
should win, but only if they are actively set.The following Cassandra properties always initialized and so always ignored in
db-config.conf
The text was updated successfully, but these errors were encountered: