尝试将一些旧实现迁移到我的项目中。如何在applicationContext.xml中配置旧实现? 从旧的代码库我得到了:
SchedulerFactory类
@Singleton
public class SchedulerFactoryOld {
private Scheduler scheduler=null;
private static SchedulerFactory factory = new StdSchedulerFactory();
@Produces
public Scheduler getScheduler() {
synchronized (factory) {
if(scheduler != null)
return scheduler;
try {
scheduler = factory.getScheduler();
} catch (SchedulerException e) {
}
return scheduler;
}
}
}
quartz.properties
org.quartz.scheduler.instanceName = QuartzScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 8
org.quartz.threadPool.threadPriority = 8
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
答案 0 :(得分:1)
这是一个基本的xml方式来启动它。您的配置选项可能不同,但您可以根据属性
引用它<bean id="scheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="yourTrigger" />
</list>
</property>
<property name="schedulerContextAsMap">
<map>
<entry key="someManagerOrBusinessCode" value-ref="someManagerOrBusinessCode" />
</map>
</property>
<property name="configLocation" value="${quartz.config.location}" />
<property name="overwriteExistingJobs" value="true" />
</bean>