spring quart配置

注入MethodInvokingJobDetailFactoryBean的targetObject和targetMethod分别为:operationLogTask的monitor方法;

然后配置CronTriggerBeancron表达式;

然后在SchedulerFactoryBean中注册triggers。

    <bean id="qh4aOpeLogMonitor"

        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

        <property name="targetObject" ref="operationLogTask" />

        <property name="targetMethod" value="monitor" />

    </bean>

    <bean id="qh4aOpeLogMonitorTrigger"

        class="org.springframework.scheduling.quartz.CronTriggerBean">

        <property name="jobDetail" ref="qh4aOpeLogMonitor" />

        <property name="cronExpression" value="15 */2 * * * ?" />

    </bean>

<!-- schedulerFactoryList -->

<bean name="quartzScheduler"

class="org.springframework.scheduling.quartz.SchedulerFactoryBean">

<property name="triggers">

<list>

<ref bean="sampleCronTrigger" />

<ref bean="qh4aOperaLogCronTrigger" />

                <ref bean="qh4aOpeLogMonitorTrigger" />

</list>

</property>

</bean>

你可能感兴趣的:(spring,bean,quartz)