1

我需要从 UI 调用的方法中访问 SchedulerFactoryBean(使用 1.8 石英)来暂停调度程序并对数据库进行批量更新。

但我无法让 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>

非常感谢您!

4

0 回答 0