ソースを参照

fix(new date时区问题)

gengyang 5 年 前
コミット
25f95ba7aa

+ 8 - 0
src/main/java/com/mokamrp/privates/PrivateServerStart.java

@@ -6,6 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
+import javax.annotation.PostConstruct;
+import java.util.TimeZone;
+
 @EnableAsync
 @EnableScheduling
 @MapperScan("com.mokamrp.privates.mapper")
@@ -14,4 +17,9 @@ public class PrivateServerStart {
     public static void main(String[] args) {
         SpringApplication.run(PrivateServerStart.class, args);
     }
+
+    @PostConstruct
+    void started() {
+        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+    }
 }