2016-01-12 1180 views
1

使用Quartz Scheduler沒有運氣。任何和所有的幫助將不勝感激!我保證你在我的pom中擁有所有必需的依賴關係。Quartz Scheduler NOT STARTED。在待機模式下

這是我的spring-config.xml。

<bean id="testObject" class="test.Test"/> 

<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> 
    <property name="targetObject" ref="testObject"/> 
    <property name="targetMethod" value="print"/> 
</bean> 

<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean"> 
    <!-- see the example of method invoking job above --> 
    <property name="jobDetail" ref="jobDetail"/> 

    <property name="startDelay" value="1000"/> 

    <property name="repeatInterval" value="5000"/> 
</bean> 

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" > 
    <property name="jobDetails"> 
     <list> 
      <ref bean="jobDetail" /> 
     </list> 
    </property> 
    <property name="triggers"> 
     <list> 
      <ref bean="simpleTrigger"/> 
     </list> 
    </property> 
    <property name="autoStartup" value="true"/> 
</bean> 

這裏是我的測試類...非常簡單。

package test; 

    public class Test { 
     public Test(){}; 

     public void print(){System.out.println("asdfasdfasdf!!!!!\n\n\n\n");} 
    } 

並且輸出是這個...

15:11:46.550 [主要] INFO org.quartz.core.QuartzScheduler - 調度器的元數據:石英調度器(v2.1.7)「的有機萃.springframework.scheduling.quartz.SchedulerFactoryBean#0'with instanceId'NON_CLUSTERED' 調度程序類:'org.quartz.core.QuartzScheduler' - 在本地運行。 未開始。 目前處於待機模式。 執行的作業數量:0 使用線程池'org.quartz.simpl.SimpleThreadPool' - 有10個線程。 使用作業存儲'org.quartz.simpl.RAMJobStore' - 不支持持久性。並沒有聚集。

回答

0

我應該顯示其餘的xml文件。該文件中還有一個其他bean使用init方法阻止了quartz調度器的啓動。如果有人能更專業地解釋爲什麼會發生這種情況,我仍然會很感激!謝謝。