spring配置定时器
来源:互联网 发布:js去掉html a标签 编辑:程序博客网 时间:2024/06/06 16:28
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<!-- 启动触发器的配置开始 -->
<bean name="startQuertz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="myJobTrigger" />
<ref bean="itemDiscountJobTrigger" />
<ref bean="matchProcessJobTrigger" />
</list>
</property>
</bean>
<!-- 启动触发器的配置结束 -->
<!-- quartz-2.x的配置 -->
<bean id="myJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="myJobDetail" /></property>
<property name="cronExpression"><value>0 15 10 15 * ?</value></property>
</bean>
<!-- 调度的配置结束 -->
<!-- job的配置开始 -->
<!--调度工厂-->
<bean id="myJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="myJob" />
</property>
<property name="targetMethod">
<value>backup</value>
</property>
</bean>
<!-- job的配置结束 -->
<!-- 工作的bean -->
<bean id="myJob" class="com.snsoft.base.core.job.BackupForMysql" />
<!-- quartz-2.x的配置 -->
<!--
<property name="cronExpression" value="0 00 22 * * ?" />
字段 允许值 允许的特殊字符
秒 0-59 , - * /
分 0-59 , - * /
小时 0-23 , - * /
日期 1-31 , - * ? / L W C
月份 1-12 或者 JAN-DEC , - * /
星期 1-7 或者 SUN-SAT , - * ? / L C #
年(可选) 留空, 1970-2099 , - * /
1 * * * * ? :代表每天每小时每分钟第1秒触发
5 * * * * ? :代表每分钟第5秒触发
0 15 * * * ?-在每天每小时15分触发
0 0 12 * * ?-在每天中午12:00触发
0 15 10 * * ?-每天上午10:15 触发
0 15 10 * * ? *-每天上午10:15 触发
0 15 10 * * ? 2005-在2005年中的每天上午10:15 触发
0 * 14 * * ?-每天在下午2:00至2:59之间每分钟触发一次
0/1 * * * * ? :代表每1秒 触发
0/2 * * * * ? :代表每2秒 触发
0 0/1 * * * ? :代表每分钟 触发
0 0 0/1 * * ? :代表每小时 触发
0 0 0 0/1 * ? :代表每天 触发
-->
<bean id="itemDiscountJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="itemDiscountJobDetail" /></property>
<property name="cronExpression"><value>1 0 * * * ?</value></property>
</bean>
<bean id="itemDiscountJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="dataItemDiscountJob" />
</property>
<property name="targetMethod">
<value>itemDiscount</value>
</property>
</bean>
<!-- 工作的bean -->
<bean id="dataItemDiscountJob" class="com.snsoft.item.controller.DataItemController" />
<bean id="matchProcessJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="matchProcessJobDetail" /></property>
<property name="cronExpression"><value>1 0 * * * ?</value></property>
</bean>
<bean id="matchProcessJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="matchProcessJob" />
</property>
<property name="targetMethod">
<value>matchProcess</value>
</property>
</bean>
<bean id="matchProcessJob" class="com.snsoft.platform.controller.DataMatchInfoController" />
</beans>
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<!-- 启动触发器的配置开始 -->
<bean name="startQuertz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="myJobTrigger" />
<ref bean="itemDiscountJobTrigger" />
<ref bean="matchProcessJobTrigger" />
</list>
</property>
</bean>
<!-- 启动触发器的配置结束 -->
<!-- quartz-2.x的配置 -->
<bean id="myJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="myJobDetail" /></property>
<property name="cronExpression"><value>0 15 10 15 * ?</value></property>
</bean>
<!-- 调度的配置结束 -->
<!-- job的配置开始 -->
<!--调度工厂-->
<bean id="myJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="myJob" />
</property>
<property name="targetMethod">
<value>backup</value>
</property>
</bean>
<!-- job的配置结束 -->
<!-- 工作的bean -->
<bean id="myJob" class="com.snsoft.base.core.job.BackupForMysql" />
<!-- quartz-2.x的配置 -->
<!--
<property name="cronExpression" value="0 00 22 * * ?" />
字段 允许值 允许的特殊字符
秒 0-59 , - * /
分 0-59 , - * /
小时 0-23 , - * /
日期 1-31 , - * ? / L W C
月份 1-12 或者 JAN-DEC , - * /
星期 1-7 或者 SUN-SAT , - * ? / L C #
年(可选) 留空, 1970-2099 , - * /
1 * * * * ? :代表每天每小时每分钟第1秒触发
5 * * * * ? :代表每分钟第5秒触发
0 15 * * * ?-在每天每小时15分触发
0 0 12 * * ?-在每天中午12:00触发
0 15 10 * * ?-每天上午10:15 触发
0 15 10 * * ? *-每天上午10:15 触发
0 15 10 * * ? 2005-在2005年中的每天上午10:15 触发
0 * 14 * * ?-每天在下午2:00至2:59之间每分钟触发一次
0/1 * * * * ? :代表每1秒 触发
0/2 * * * * ? :代表每2秒 触发
0 0/1 * * * ? :代表每分钟 触发
0 0 0/1 * * ? :代表每小时 触发
0 0 0 0/1 * ? :代表每天 触发
-->
<bean id="itemDiscountJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="itemDiscountJobDetail" /></property>
<property name="cronExpression"><value>1 0 * * * ?</value></property>
</bean>
<bean id="itemDiscountJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="dataItemDiscountJob" />
</property>
<property name="targetMethod">
<value>itemDiscount</value>
</property>
</bean>
<!-- 工作的bean -->
<bean id="dataItemDiscountJob" class="com.snsoft.item.controller.DataItemController" />
<bean id="matchProcessJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail"><ref bean="matchProcessJobDetail" /></property>
<property name="cronExpression"><value>1 0 * * * ?</value></property>
</bean>
<bean id="matchProcessJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="matchProcessJob" />
</property>
<property name="targetMethod">
<value>matchProcess</value>
</property>
</bean>
<bean id="matchProcessJob" class="com.snsoft.platform.controller.DataMatchInfoController" />
</beans>
阅读全文
0 0
- spring定时器的配置
- spring 定时器时间配置
- Spring定时器配置
- spring中配置定时器
- java Spring定时器配置
- Spring定时器配置
- spring quartz配置定时器
- spring定时器配置
- spring 定时器配置
- spring 定时器时间配置
- SPRING定时器配置
- spring quartz 配置(定时器)
- Spring中配置定时器
- Spring定时器的配置
- Spring定时器配置
- spring定时器配置
- spring定时器时间配置
- spring定时器简单配置
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xf5
- jsp导入所需要的JavaBean方法
- LINUX系统常用的文件操作命令
- 10个经典的 Java main 方法面试题
- 使用console的高级应用来测试javascript性能(实测)
- spring配置定时器
- “由于本机的限制,该操作已被取消,请与管理员联系”的解决"
- tar.xz和tar.bz(bz2)文件压缩与解压小记
- C++中的explicit关键字
- Unity优化——网格合并
- Android之URL Scheme使用
- 搜索-D
- Wireshark之利用IO Graph分析数据并将数据复制到excel中生成图
- Pointer_3