spring定时器配置
来源:互联网 发布:php图片用什么打开 编辑:程序博客网 时间:2024/06/04 23:17
在xml中配置如下:<!-- 执行错误sql的定时器 -->
<bean id="executor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="100" />
<property name="queueCapacity" value="500" />
</bean>
<bean id="ExecuteErrorSql" class="com.ustcinfo.ptp.bwp.ExeAndBackupLogSql" />
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="ExecuteErrorSql" />
<property name="targetMethod" value="executeSql" />
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="cronExpression" value="0 44 16 ? * *" />
</bean>
<bean id="taskTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="startDelay" value="10000" />
<property name="repeatInterval" value="60000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
<property name="taskExecutor" ref="executor" />
</bean>
<bean id="executor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="100" />
<property name="queueCapacity" value="500" />
</bean>
<bean id="ExecuteErrorSql" class="com.ustcinfo.ptp.bwp.ExeAndBackupLogSql" />
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="ExecuteErrorSql" />
<property name="targetMethod" value="executeSql" />
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="cronExpression" value="0 44 16 ? * *" />
</bean>
<bean id="taskTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="startDelay" value="10000" />
<property name="repeatInterval" value="60000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
<property name="taskExecutor" ref="executor" />
</bean>
<!-- 定时器结束 -->
在java类中引用:
ClassPathXmlApplicationContext timerExecute = new ClassPathXmlApplicationContext(
"timerExecute.xml");//定时器配在timeExecute.xml
timerExecute.start();//启动定时器
0 0
- spring定时器的配置
- spring 定时器时间配置
- Spring定时器配置
- spring中配置定时器
- java Spring定时器配置
- Spring定时器配置
- spring quartz配置定时器
- spring定时器配置
- spring 定时器配置
- spring 定时器时间配置
- SPRING定时器配置
- spring quartz 配置(定时器)
- Spring中配置定时器
- Spring定时器的配置
- Spring定时器配置
- spring定时器配置
- spring定时器时间配置
- spring定时器简单配置
- Cocoa深入学习:NSOperationQueue、NSRunLoop和线程安全
- 《深入浅出struts2》--第三章,动作与结果
- ZOJ3690Choosing number
- hive-0.11.0安装方法详解
- POJ 1944:Fiber Communications
- spring定时器配置
- 收藏网站55
- 成员函数类型 成员函数指针
- 读书笔记:大小端模式对位域的影响
- Linux下批量重命名文件bash命令详解
- 移动APP产品经理必学的工具和必上的酷站
- POJ 3270 Cow Sorting(置换环)
- 【暴力搜索】[UVa 11212]Editing a Book
- 收藏网站57