简体   繁体   中英

How do I get a list of scheduled quartz job in spring?

I am having some trouble figuring out how to get the list of scheduled jobs. I have the jobs, triggers, and scheduler declared as beans in my servlet-context.xml file. The job fires correctly and completes. I know I am suppose to use the scheduleFactory to grab a scheduler and do something like:

for(String group: sched.getJobGroupNames()) {
    // enumerate each job in group
    for(JobKey jobKey : sched.getJobKeys(groupEquals(group))) {
        System.out.println("Found job identified by: " + jobKey);
    }

Though, I do not know how to get the scheduleFactory instance from the bean since I am not suppose to be creating a new one. I have gathered all this info from searching many forums including here.

Please help me regarding this.

您必须在类中注入scheduleFactory (如果使用批注,则使用@Autowired)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM