在Spring Boot中更改serverTimezone

时间:2019-05-07 08:40:06

标签: spring-boot jdbc

我想将serverTimezone更改为GMT + 3。 我尝试了这个但没用

spring.datasource.url=jdbc:mysql://localhost:3306/example?useSSL=false&serverTimezone=GMT+3&useLegacyDatetimeCode=false
Caused by: java.sql.SQLException: No timezone mapping entry for 'GMT 3'

但是如果我运行它,它将与GMT-3一起使用

spring.datasource.url=jdbc:mysql://localhost:3306/example?useSSL=false&serverTimezone=GMT-3&useLegacyDatetimeCode=false

如何将其更改为GMT + 3?

1 个答案:

答案 0 :(得分:-1)

请按如下所示在主启动应用中覆盖PostConstruct

val mergedStream = streamBuilder.merge(sensor1Stream, sensor2Stream, sensor3Stream, sensor4Stream)

mergedStream.to(Serdes.String(), heartbeatSerde, "Merged-SensorsHeartbeat")

用您的时区替换亚洲/加尔各答