mxcsdn 2010-07-27
<!-- 服务 --> <bean id="datagrabImpl" class="com.gflex.datacollect.datagrab.impl.DatagrabImpl"></bean> <!--任务 --> <bean id="timerGrab" class="com.gflex.datacollect.datagrab.TimerGrab"> <property name="datagrabService" ref="datagrabService"></property> </bean> <!-- 任务调度器, --> <bean id="scheduledTimerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <!-- 指定执行哪个任务 --> <property name="timerTask" ref="timerGrab"></property> <!-- 应用程序启动多久后(1.5分钟后),执行任务 --> <property name="delay" value="65000"></property> </bean> <!-- 启动定时器,Spring的TimerFactoryBean负责启动定时任务 --> <bean id="timerFactoryBean" class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref bean="scheduledTimerTask"/> </list> </property> </bean>