All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.ennwifi.webframe.configure.SystemPropertyDefaultsInitializer Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package cn.ennwifi.webframe.configure;

import cn.ennwifi.webframe.tools.Times;

import java.sql.Timestamp;
import java.util.TimeZone;
import java.util.logging.Logger;

/**
 * The type System property defaults initializer.
 */
public class SystemPropertyDefaultsInitializer {

  private static final Logger logger = Logger.getLogger(SystemPropertyDefaultsInitializer.class
      .getName());


    /**
     * Initialize.
     */
    public void initialize() {
    logger.info("SystemPropertyWebApplicationInitializer onStartup called");

    printTimes();
    // can be set runtime before Spring instantiates any beans
    // TimeZone.setDefault(TimeZone.getTimeZone("GMT+00:00"));
    TimeZone.setDefault(TimeZone.getTimeZone("GMT+08:00"));

    printTimes();

  }

  private void printTimes() {
    logger.info("=============时间信息打印=============");
    long now = System.currentTimeMillis();
    logger.info("系统时间戳:" + now);
    logger.info("格式化:" + Times.formatTime(now));
    Timestamp tnow = Times.now();
    logger.info("Timestamp:" + Times.formatTime(tnow));

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy