定时任务日志更新
This commit is contained in:
@@ -2,43 +2,27 @@ package org.nl.start;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.quartz.domain.QuartzJob;
|
||||
import org.nl.modules.quartz.repository.QuartzJobRepository;
|
||||
import org.nl.modules.quartz.utils.QuartzManage;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 随项目启动模块
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(0)
|
||||
public class Init implements ApplicationRunner {
|
||||
private final QuartzJobRepository quartzJobRepository;
|
||||
private final QuartzManage quartzManage;
|
||||
|
||||
|
||||
private void init() throws Exception {
|
||||
//初始化WQL
|
||||
initWql();
|
||||
//初始化任务调度
|
||||
initQuartz();
|
||||
System.out.println("项目启动成功!");
|
||||
}
|
||||
|
||||
private void initQuartz() {
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<QuartzJob> quartzJobs = quartzJobRepository.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
|
||||
}
|
||||
|
||||
private void initWql() throws Exception {
|
||||
WQLCore.ROOT = "org.nl";
|
||||
WQLCore.init();
|
||||
|
||||
Reference in New Issue
Block a user