spring定时任务配置
<!-- 启动定时任务管理 -->
<bean name="startQuertz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="pickAndExecCollectTasksTrigger" />
</list>
</property>
</bean>
<!-- 定时触发配置 -->
<bean id="pickAndExecCollectTasksTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="pickAndExecCollectTasksDetail" />
<property name="cronExpression">
<!--整点和30分钟 -->
<!-- value>0 0,30 * * * ?</value-->
<value>* * * * * ?</value>
</property>
</bean>
<!-- 定时任务详情 -->
<bean id="pickAndExecCollectTasksDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="pickAndExecCollectTasks" />
<property name="targetMethod" value="exec"/>
<!-- 不允许重叠执行 -->
<property name="concurrent" value="false"/>
</bean>
<!-- 定时任务bean -->
<bean id="pickAndExecCollectTasks" class="com.jundong.Cron">
</bean>
需要导入额外的jar包 spring-context-support-3.2.0.RELEASE.jar com.springsource.org.quartz-1.6.2.jar ,可以在spring依赖包中找到