From 7c26ec693561ecce9fba31ab4e83e9f30d641aad Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 06 五月 2024 17:57:40 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/2.0' into 2.0 --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java index df97b22..dd1bdba 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java @@ -2,10 +2,13 @@ import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.modular.system.util.GDFalconUtil; +import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; +import com.stylefeng.guns.modular.system.util.quartz.SchedulerUtil; import org.apache.http.client.HttpClient; import org.apache.http.config.SocketConfig; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.quartz.SchedulerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +26,10 @@ import org.springframework.web.client.RestTemplate; import javax.annotation.PostConstruct; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.TimeZone; @@ -42,14 +49,22 @@ public static void main(String[] args) { SpringApplication.run(GunsApplication.class, args); + + try { + //启动定时任务调度器 + QuartzUtil.start(GunsApplication.class.getClassLoader().getResourceAsStream("quartz.properties")); + } catch (SchedulerException e) { + throw new RuntimeException(e); + } + logger.info("GunsApplication is success!"); } - @PostConstruct - void started() { - TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); - } +// @PostConstruct +// void started() { +// TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); +// } @Bean //SpringCloud内部服务质检使用服务名调用 -- Gitblit v1.7.1