It seems almost every Cassandra @Configuration class declares its own private static class CassandraDriverOptions; AbstractSessionConfiguration does, CassandraAutoConfiguration does too. Apart from duplication of code, hiding the driver options from the users means configurations that are not exposed through CassandraProperties can't be easily done.
It would make a lot of sense to make the CassandraDriverOptions public, create a CassandraDriverOptionsConfigurer type, and call user provided implementations of the latter while building the options.
Currently I do something like this, which is a lot of unnecessary code:
CassandraDriverOptions is an internal utility that is used as holder for driver options. Instead of exposing the internal utility, it would make sense to introduce a customizer for ProgrammaticDriverConfigLoaderBuilder. (See DriverConfigLoaderBuilderCustomizer for reference).
By customizing the actual builder you can use the public driver API to apply your customizations.
DriverConfigLoaderBuilderCustomizer is part of Spring Boot. We would copy the concept into Spring Data Cassandra so you can apply customization in the same way by just using Spring Data Cassandra, without Spring Boot
spring-projects-issues commentedSep 1, 2020
Abhijit Sarkar opened DATACASS-798 and commented
It seems almost every Cassandra
@Configuration
class declares its ownprivate static class CassandraDriverOptions
;AbstractSessionConfiguration
does,CassandraAutoConfiguration
does too. Apart from duplication of code, hiding the driver options from the users means configurations that are not exposed throughCassandraProperties
can't be easily done.It would make a lot of sense to make the
CassandraDriverOptions
public, create aCassandraDriverOptionsConfigurer
type, and call user provided implementations of the latter while building the options.Currently I do something like this, which is a lot of unnecessary code:
Affects: 3.0.3 (Neumann SR3)
Backported to: 3.1.2 (2020.0.2)
The text was updated successfully, but these errors were encountered: