'Spring data cassandra (v3.3.1): how to add codec?
I use spring-data-cassandra:3.3.1
and try to apply TimestampCodec
. Documentation says that all codecs should be added through CodecRegistry
, but says nothing about a way to access it.
I use config like this:
@Configuration
@EnableReactiveCassandraRepositories("com.example.repo")
public class CassandraConfig extends AbstractReactiveCassandraConfiguration
...but I don't understand how could I provide codecs.
Any ideas / examples?
Solution 1:[1]
You can override getSessionBuilderConfigurer
inside your CassandraConfig
class:
@Override
protected SessionBuilderConfigurer getSessionBuilderConfigurer() {
return (sessionBuilder) -> sessionBuilder.addTypeCodecs(ExtraTypeCodecs.LOCAL_TIMESTAMP_UTC);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alexander Gamaunov |