我需要从UI调用的方法访问SchedulerFactoryBean(使用1.8 quartz with spring)来暂停调度程序并对数据库进行批量更新。
但是我不能让bean注入工作,给我一个错误:
org.springframework.beans.factory.BeanCurrentlyInCreationException:创建名为'runProcessBranchFolders'的bean时出错:当前处于创建状态的FactoryBean从getObject返回null
以下是applicationContext.xml
中的相关代码(我希望如此)
<bean id="cleanHistoricFolder" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="catalogFacadeTarget"/>
<property name="targetMethod" value="cleanHistoricFolder"/>
<property name="concurrent" value="false"/>
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<!-- see the example of method invoking job above -->
<property name="jobDetail" ref="runProcessBranchFolders"/>
<!-- 10 seconds -->
<property name="startDelay" value="10000"/>
<!-- repeat every 10 seconds -->
<property name="repeatInterval" value="180000"/>
</bean>
<bean id="cleanHistoricFolderTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="cleanHistoricFolder"/>
<!-- 1 minute -->
<property name="startDelay" value="60000"/>
<!-- repeat 24 hours -->
<property name="repeatInterval" value="86400000"/>
</bean>
<bean id="schedulerFactoryBeanTarget" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTrigger"/>
<ref bean="cleanHistoricFolderTrigger"/>
</list>
</property>
</bean>
<!-- ========================= BUSINESS OBJECT DEFINITIONS ======================== -->
<bean id="catalogFacadeTarget" class="com.bamboo.catW3.business.impl.CatalogFacadeImpl">
<property name="categoryDAO">
<ref local="categoryDAOTarget"/>
.
.
.
<property name="schedulerFactoryBean" >
<ref local="schedulerFactoryBeanTarget" />
</property>
</bean>
非常感谢你!