<bean id="checkWiner" class="com.daacc.schedule.CheckWiner">
<property name="mgr">
<ref local="userServiceTarget"/>
</property>
</bean>
<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="delay">
<value>0</value>
</property>
<property name="period">
<value>10000</value>
</property>
<property name="timerTask">
<ref local="checkWiner"/>
</property>
</bean>
<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>
<ref bean="scheduledTask"/>
</list>
</property>
</bean>
<property name="mgr">
<ref local="userServiceTarget"/>
</property>
</bean>
<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="delay">
<value>0</value>
</property>
<property name="period">
<value>10000</value>
</property>
<property name="timerTask">
<ref local="checkWiner"/>
</property>
</bean>
<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>
<ref bean="scheduledTask"/>
</list>
</property>
</bean>
待续
本文介绍了一个使用Spring框架配置定时任务的例子。通过配置,可以实现每10秒执行一次检查赢家的服务逻辑。涉及到Spring的ScheduledTimerTask和TimerFactoryBean组件。
1957

被折叠的 条评论
为什么被折叠?



