我有一個系統,當每天到達固定的時間後會對數據庫進行清空
該怎麼處理,用JAVA語言編寫
<bean id="quartzClock" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>java文件路徑</value>
</property>
</bean>
<!-- 這種配置可以精確幾點執行定時任務 -->
<bean id="cronQuartzClock" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="quartzClock" />
<property name="cronExpression">
<!-- 0/10 * * * * ? 每10秒鐘 -->
<value>0 0/10 * * * ?</value>
</property>
</bean>
<!--第三步 啟動定時任務,注意這裡的ref bean -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronQuartzClock" />
</list>
</property>
</bean>
java文件
public class XXXX extends QuartzJobBean{
protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException {
logger.debug("定時任務自動收取郵件; 開始..........");
}