项目中经常有用到后台任务的情况,因此稍做记录。
业务类:
配置文件:
另一种方法:([url]http://www.oschina.net/question/8676_9032[/url]).
业务类:
public class SamsungXmlLoad extends QuartzJobBean {
@Override
protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException {
//...do something
}
}
配置文件:
<bean id="jobDetail2" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.dounion.siis.util.jobs.SamsungXmlLoad" />
<property name="jobDataAsMap">
<map>
<entry key="bizSamsungBusiness" value-ref="bizSamsungBusinessProxy"/>
</map>
</property>
<property name="applicationContextJobDataKey" value="applicationContext" />
</bean>
<bean id="simpleTriggerBean2" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref bean="jobDetail2"/>
</property>
<property name="repeatInterval">
<value>120000</value>
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTriggerBean2"/>
</list>
</property>
</bean>
另一种方法:([url]http://www.oschina.net/question/8676_9032[/url]).