Spring Quartz集成Quartz初始化两次

时间:2014-08-15 06:43:21

标签: spring quartz-scheduler jersey-2.0

我一直致力于将当前项目与Jersey集成,Web应用程序使用Spring进行IOC和Quartz调度。但是在获取配置后,我会在启动期间在日志文件中注意到以下内容:

2014-08-15 05:43:10,830 INFO  org.quartz.core.SchedulerSignalerImpl.<init>:63 - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2014-08-15 05:43:10,834 INFO  org.quartz.core.QuartzScheduler.<init>:215 - Quartz Scheduler v.1.6.5 created.
2014-08-15 05:43:10,838 INFO  org.quartz.simpl.RAMJobStore.initialize:141 - RAMJobStore initialized.
2014-08-15 05:43:10,840 INFO  org.quartz.impl.StdSchedulerFactory.instantiate:1229 - Quartz scheduler 'syncSchContext' initialized from an externally provided properties instance.
2014-08-15 05:43:10,841 INFO  org.quartz.impl.StdSchedulerFactory.instantiate:1233 - Quartz scheduler version: 1.6.5
2014-08-15 05:43:10,848 INFO  org.quartz.core.QuartzScheduler.setJobFactory:2094 - JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@210e5887
2014-08-15 05:43:10,995 INFO  org.quartz.core.SchedulerSignalerImpl.<init>:63 - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2014-08-15 05:43:10,996 INFO  org.quartz.core.QuartzScheduler.<init>:215 - Quartz Scheduler v.1.6.5 created.
2014-08-15 05:43:10,997 INFO  org.quartz.simpl.RAMJobStore.initialize:141 - RAMJobStore initialized.
2014-08-15 05:43:10,997 INFO  org.quartz.impl.StdSchedulerFactory.instantiate:1229 - Quartz scheduler 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' initialized from an externally provided properties instance.
2014-08-15 05:43:10,997 INFO  org.quartz.impl.StdSchedulerFactory.instantiate:1233 - Quartz scheduler version: 1.6.5
2014-08-15 05:43:10,998 INFO  org.quartz.core.QuartzScheduler.setJobFactory:2094 - JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@cd79d78
2014-08-15 05:43:11,795 INFO  org.quartz.core.QuartzScheduler.start:461 - Scheduler     syncSchContext_$_NON_CLUSTERED started.
2014-08-15 05:43:11,796 INFO  org.quartz.core.QuartzScheduler.start:461 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED started.

可能导致此初始化发生两次的原因是什么?

1 个答案:

答案 0 :(得分:1)

导致调度程序运行两次的最常见情况是,如果Bean调度的bean包含在多个上下文中。

确保计划的bean仅属于根应用程序上下文。