×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Davide Davide
Added: Oct 13, 2022 10:23 AM
Views: 6
Tags: java spring
  1. @Value("${application.default.timezone}")
  2.     String defaultTimeZone;
  3.  
  4.     @PostConstruct
  5.     public void init() {
  6.         // Setting Spring Boot SetTimeZone
  7.         TimeZone.setDefault(TimeZone.getTimeZone(defaultTimeZone));
  8.         log.info("Spring boot application running in {} timezone, now was: {}", defaultTimeZone, new Date());   // It will print now at default timezone
  9.     }