How do I force a Spring Boot JVM into UTC time zone?

I think you can set your application’s timezone on your application level. I think this link will help you.
https://www.onlinetutorialspoint.com/spring-boot/how-to-set-spring-boot-settimezone.html

So What you need to do is adding “@PostConstruct” annotation to the main class where “@SpringBootApplication” annotation is located, and add timezone setting method there. Here is an example.

@SpringBootApplication
public class HellotimezoneApplication {

    public static void main(String[] args) {
        SpringApplication.run(HellotimezoneApplication.class, args);
    }

    @PostConstruct
    public void init(){
      // Setting Spring Boot SetTimeZone
      TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }

}

Hope this can help you!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)