1. <tfoot id='cK8yj'></tfoot>
      <bdo id='cK8yj'></bdo><ul id='cK8yj'></ul>

    <legend id='cK8yj'><style id='cK8yj'><dir id='cK8yj'><q id='cK8yj'></q></dir></style></legend>

      <small id='cK8yj'></small><noframes id='cK8yj'>

      <i id='cK8yj'><tr id='cK8yj'><dt id='cK8yj'><q id='cK8yj'><span id='cK8yj'><b id='cK8yj'><form id='cK8yj'><ins id='cK8yj'></ins><ul id='cK8yj'></ul><sub id='cK8yj'></sub></form><legend id='cK8yj'></legend><bdo id='cK8yj'><pre id='cK8yj'><center id='cK8yj'></center></pre></bdo></b><th id='cK8yj'></th></span></q></dt></tr></i><div id='cK8yj'><tfoot id='cK8yj'></tfoot><dl id='cK8yj'><fieldset id='cK8yj'></fieldset></dl></div>

    1. 如何强制 Spring Boot JVM 进入 UTC 时区?

      How do I force a Spring Boot JVM into UTC time zone?(如何强制 Spring Boot JVM 进入 UTC 时区?)
      1. <small id='Ybalh'></small><noframes id='Ybalh'>

              <bdo id='Ybalh'></bdo><ul id='Ybalh'></ul>

            • <legend id='Ybalh'><style id='Ybalh'><dir id='Ybalh'><q id='Ybalh'></q></dir></style></legend>
                <tfoot id='Ybalh'></tfoot>
                  <tbody id='Ybalh'></tbody>
                <i id='Ybalh'><tr id='Ybalh'><dt id='Ybalh'><q id='Ybalh'><span id='Ybalh'><b id='Ybalh'><form id='Ybalh'><ins id='Ybalh'></ins><ul id='Ybalh'></ul><sub id='Ybalh'></sub></form><legend id='Ybalh'></legend><bdo id='Ybalh'><pre id='Ybalh'><center id='Ybalh'></center></pre></bdo></b><th id='Ybalh'></th></span></q></dt></tr></i><div id='Ybalh'><tfoot id='Ybalh'></tfoot><dl id='Ybalh'><fieldset id='Ybalh'></fieldset></dl></div>
              • 本文介绍了如何强制 Spring Boot JVM 进入 UTC 时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我看到 强制 Java 时区为 GMT/UTC

                我试过了

                • mvn spring-boot:run -Dexec.args="-Duser.timezone=GMT"
                • mvn spring-boot:run -Dexec.args="-Duser.timezone=UTC"
                • config/application.properties
                • 中的user.timezone=UTC
                • user.timezone=GMT
                • 在 pom.xml 中:

                   <插件><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><配置><属性><spring-boot.run.jvmArguments>-Duser.timezone=UTC</spring-boot.run.jvmArguments></属性></配置></插件>

                • mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Duser.timezone=UTC"

                但它会打印出来

                System.out.println(TimeZone.getDefault());

                <块引用>

                sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]

                Spring Boot 1.5.19,Java 8

                解决方案

                使用 spring-boot.run.jvmArguments 属性 如果您想将 JVM 选项从 Maven Spring Boot 插件传递到分叉的 Spring Boot 应用程序:

                <spring-boot.run.jvmArguments>-Duser.timezone=UTC</spring-boot.run.jvmArguments></属性>

                这相当于命令行语法:

                mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Duser.timezone=UTC"

                或在运行完全打包的 Spring Boot 应用程序时:

                java -Duser.timezone=UTC -jar app.jar

                I saw Force Java timezone as GMT/UTC

                I tried

                • mvn spring-boot:run -Dexec.args="-Duser.timezone=GMT"
                • mvn spring-boot:run -Dexec.args="-Duser.timezone=UTC"
                • user.timezone=UTC in config/application.properties
                • user.timezone=GMT
                • In the pom.xml:

                      <plugin>
                          <groupId>org.springframework.boot</groupId>
                          <artifactId>spring-boot-maven-plugin</artifactId>
                          <configuration>
                              <properties>
                                <spring-boot.run.jvmArguments>-Duser.timezone=UTC</spring-boot.run.jvmArguments>
                              </properties>
                          </configuration>
                      </plugin>
                  

                • mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Duser.timezone=UTC"

                But it prints out

                System.out.println(TimeZone.getDefault());
                

                sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]

                Spring Boot 1.5.19, Java 8

                解决方案

                Use spring-boot.run.jvmArguments property if you want to pass JVM options from Maven Spring Boot Plugin to forked Spring Boot application:

                <properties>
                  <spring-boot.run.jvmArguments>-Duser.timezone=UTC</spring-boot.run.jvmArguments>
                </properties>
                

                This is be equivalent to command line syntax:

                mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Duser.timezone=UTC"
                

                or when running a fully packaged Spring Boot application:

                java -Duser.timezone=UTC -jar app.jar
                

                这篇关于如何强制 Spring Boot JVM 进入 UTC 时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                  <tbody id='1hRTD'></tbody>
                <legend id='1hRTD'><style id='1hRTD'><dir id='1hRTD'><q id='1hRTD'></q></dir></style></legend>

                <i id='1hRTD'><tr id='1hRTD'><dt id='1hRTD'><q id='1hRTD'><span id='1hRTD'><b id='1hRTD'><form id='1hRTD'><ins id='1hRTD'></ins><ul id='1hRTD'></ul><sub id='1hRTD'></sub></form><legend id='1hRTD'></legend><bdo id='1hRTD'><pre id='1hRTD'><center id='1hRTD'></center></pre></bdo></b><th id='1hRTD'></th></span></q></dt></tr></i><div id='1hRTD'><tfoot id='1hRTD'></tfoot><dl id='1hRTD'><fieldset id='1hRTD'></fieldset></dl></div>

                        • <bdo id='1hRTD'></bdo><ul id='1hRTD'></ul>

                        • <small id='1hRTD'></small><noframes id='1hRTD'>

                          <tfoot id='1hRTD'></tfoot>