package com.huihe.exam; import com.huihe.exam.mapper.ScheduleMapper; import com.huihe.exam.task.LoadOrgsTask; import com.huihe.exam.task.SchedulerTask; import com.huihe.exam.task.TaskAdmin; import org.mybatis.spring.annotation.MapperScan; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import java.util.List; import java.util.TimeZone; @SpringBootApplication @MapperScan("com.huihe.exam.mapper") @EnableScheduling @EnableAsync public class ServiceExamApplication { public static ApplicationContext applicationContext; private static final Logger LOG = LoggerFactory.getLogger(ServiceExamApplication.class); public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(ServiceExamApplication.class, args); ServiceExamApplication.applicationContext = context; LOG.info("设置时区为东八区"); TimeZone timeZone = TimeZone.getTimeZone("GMT+8"); TimeZone.setDefault(timeZone); LOG.info("处理执行中的定时任务"); ScheduleMapper scheduleMapper = context.getBean(ScheduleMapper.class); List<SchedulerTask> runningTaskList = scheduleMapper.getRunningTask(); TaskAdmin taskAdmin = context.getBean(TaskAdmin.class); taskAdmin.handleTasks(runningTaskList); LOG.info("加载机构和电话号码信息"); LoadOrgsTask task = context.getBean(LoadOrgsTask.class); task.loadOrgInfo(); LOG.info("考试服务启动..."); } }
点击查看更多内容
1人点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦