Comments (15)
You can add cassandra.embedded.system-properties[user.timezone]=Asia/Seoul
to your application.properties
from embedded-cassandra-spring-boot-starter.
Or you can do:
@Bean
public CassandraBuilderConfigurator timezoneConfigurator(){
return builder -> builder.addSystemProperty("user.timezone","Asia/Seoul");
}
from embedded-cassandra-spring-boot-starter.
Thanks for the reply
However, the code does not work and I get an error.
I don't have CassandraBuilderConfigurator.
What is CassandraBuilderConfigurator?
I used public class CassandraConfig extends AbstractReactiveCassandraConfiguration {}
I tried converting the local time as follows, but it doesn't work
@Bean
public CassandraCustomConversions customConversions() {
List<Converter<?, ?>> converters = new ArrayList<>();
Set<Converter<?, ?>> converters2 = new HashSet<>();
converters.add(new MyCustomConverter());
return new CassandraCustomConversions(converters);
}
@ReadingConverter
public class MyCustomConverter implements Converter<Instant, LocalDateTime> {
@Override public LocalDateTime convert(Instant instant) { // 여기에서 필요한 변경사항을 적용하면 됩니다.
// return LocalDateTime.ofInstant(instant, ZoneOffset.of("+09:00"));
return ZonedDateTime.now(ZoneId.of("Asia/Seoul")).toLocalDateTime();
}
}
It's a web application, so it shouldn't affect time settings in other parts.
Isn't there a better way?
thank you
from embedded-cassandra-spring-boot-starter.
What version do you use? (Cassandra spring boot starter)
Have tried application properties?
from embedded-cassandra-spring-boot-starter.
I am using embedded Cassandra 3.11.7 with spring boot.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra-spring-boot-starter</artifactId>
<version>2.0.5</version>
I have application propertise.
#Update Property File
#Tue Jan 19 09:46:34 KST 2021
cassandra.password=cassandra
cassandra.username=cassandra
cassandra.keyspace=manage
cassandra.ip=127.0.0.1
cassandra.port=9042
cassandra.jvm.xms=2g
cassandra.jvm.xmx=4g
from embedded-cassandra-spring-boot-starter.
Now it is clear :)
application.properties:
com.github.nosan.embedded.cassandra.system-properties[user.timezone]=Asia/Seoul
or
@Bean
public CassandraFactoryCustomizer<EmbeddedCassandraFactory> timezoneCustomizer(){
return cassandraFactory -> cassandraFactory.getSystemProperties().put("user.timezone","Asia/Seoul");
}
from embedded-cassandra-spring-boot-starter.
thank for the reply.
However, it does not apply.
Here's what's applied:
- cassandra propertise
cassandra.timezone=Asia/Seoul
- cassandra config
@Value("${cassandra.timezone}") private String timezone;
- timezoneCustomizer method add
@Bean public CassandraFactoryCustomizer<EmbeddedCassandraFactory> timezoneCustomizer(){ return cassandraFactory -> cassandraFactory.getSystemProperties().put("cassandra.timezone", timezone); }
- inser data - create time check
current time : 2022-04-19 17:20:35
DB insert time : 2022-04-19 08:15:35
There is still a 9 hour difference.
from embedded-cassandra-spring-boot-starter.
Why cassandra.timezone
? Where did you get this?
from embedded-cassandra-spring-boot-starter.
I have cassadra.config
cassandra.username=
cassandra.keyspace=manage
cassandra.ip=127.0.0.1
cassandra.port=9042
cassandra.jvm.xms=2g
cassandra.jvm.xmx=4g```
from embedded-cassandra-spring-boot-starter.
@Value("${cassandra.timezone}") private String timezone;
@Bean
public CassandraFactoryCustomizer<EmbeddedCassandraFactory> timezoneCustomizer() {
return cassandraFactory -> cassandraFactory.getSystemProperties().put("user.timezone", timezone);
}
from embedded-cassandra-spring-boot-starter.
The insert time and the current time are still different.
Is it forced to change to utc timezone when inserted in cassandra?
from embedded-cassandra-spring-boot-starter.
user.timezone
Java system property explicitly set a default time zone for Apache Cassandra.
How actually Cassandra treats this property I don't know, it is better to ask Cassandra's team.
from embedded-cassandra-spring-boot-starter.
I believe your question is not related to Embedded Cassandra. Looks like you have a general issue with how to work date-time values in Apache Cassandra.
from embedded-cassandra-spring-boot-starter.
thank you for your reply
If you know the Apache Cassandra official contact github address or Q&A site address, please share.
from embedded-cassandra-spring-boot-starter.
https://cassandra.apache.org/_/community.html
from embedded-cassandra-spring-boot-starter.
Related Issues (8)
- Spring Boot Unit Test Example with embedded Cassandra DB? HOT 5
- embedded-cassandra on Java 17 HOT 2
- How do I set up authentication? HOT 2
- Java 17 with Cassandra running on java 8 HOT 9
- Spring Boot test is failing with NoClassDefFoundError of StringUtils HOT 30
- Webflux problem HOT 8
- Load CQL scripts in tests. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embedded-cassandra-spring-boot-starter.