刚做项目中的任务调度,高级的方法不会(望大家告诉点高级货色),笨点的方法是:
<bean id="testTask" class="com.sqmis.task.TestTask">
<property name="repositoryContentService"
ref="repositoryContentServiceAopProxy" />
</bean>
<bean id="methodInvokingJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"><ref bean="testTask"/></property>
<!-- <property name="targetMethod"><value>hotVisitPrepare</value></property>-->
<property name="targetMethod"><value>repositoryAbate</value></property>
</bean>
<bean id="hotVisitPrepareMethodInvokingJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"><ref bean="testTask"/></property>
<property name="targetMethod"><value>hotVisitPrepare</value></property>
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="methodInvokingJobDetail"/>
</property>
<property name="cronExpression">
<value>0 0 1 * * ?</value>
</property>
</bean>
<bean id="hotVisitPrepareCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="hotVisitPrepareMethodInvokingJobDetail"/>
</property>
<property name="cronExpression">
<value>0 30 1 * * ?</value>
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref local="cronTrigger"/>
<ref local="hotVisitPrepareCronTrigger"/>
</list>
</property>
</bean>