Spring quartz 后台任务

项目中经常有用到后台任务的情况,因此稍做记录。
业务类:
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>


另一种方法:( http://www.oschina.net/question/8676_9032).

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