quartz 时间调度器 配置文件

来源:互联网 发布:云计算岗位多吗 编辑:程序博客网 时间:2024/05/22 05:23
废话不多说直接上配置文件
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:cache="http://www.springframework.org/schema/cache"xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"default-lazy-init="false"><!-- 配置需要定时的bean类 --><bean id="festivalRemindTask" class="com.cl.business.khkq.util.festivalRemindTask"></bean><!-- 工程交付周期表 --><bean id="periodChartTask" class="com.cl.business.pcdm.util.PeriodChartTask"></bean><!-- 配置任务的具体类和方法 --><bean id="startWorkTask"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><!-- 要调用的bean --><property name="targetObject" ref="festivalRemindTask"></property><!-- 要调用的Method --><property name="targetMethod" value="festivalRemind"></property><!-- <property name="targetMethod" value="nsTime"></property> <property name="targetMethod" value="nsWarnTime"></property> <property name="targetMethod" value="validDate"></property> --><!-- <property name="targetMethod"> <value>festivalRemind</value> <value>nsTime</value> <value>nsWarnTime</value> <value>validDate</value> </property> --><!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 --><property name="concurrent" value="false"></property></bean><bean id="startPeriodChartTask"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><!-- 要调用的bean --><property name="targetObject" ref="periodChartTask"></property><!-- 要调用的Method --><property name="targetMethod" value="runTask"></property><!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 --><property name="concurrent" value="false"></property></bean><!-- 配置一个触发器 --><bean id="startWorkTrigger"class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"><property name="jobDetail" ref="startWorkTask"></property><!-- 0 0/1 * * * ? 每分钟执行一次 --><property name="cronExpression" value="0 0 10 * * ?"></property> <!--每天的上午十点触发"0 45 11 * * ?" --><!-- <property name="cronExpression" value="0 0/1 * * * ?"></property> --><!--每五分钟执行一次 --></bean><!--工程交付周期表触发器 --><bean id="periodChartTaskTrigger"class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"><property name="jobDetail" ref="startPeriodChartTask"></property><!-- 0 0/1 * * * ? 每分钟执行一次 --><!-- <property name="cronExpression" value="0 0 10 * * ?"></property> --> <!--每天的上午十点触发"0 45 11 * * ?" --> <property name="cronExpression" value="0 0/5 * * * ?"></property> <!--每五分钟执行一次 --></bean><!-- 总调度,用于启动定时器 --><bean id="schedulerFactory"class="org.springframework.scheduling.quartz.SchedulerFactoryBean"><property name="triggers"><list><ref bean="startWorkTrigger" /><!-- <ref bean="periodChartTaskTrigger" /> --></list></property></bean></beans>




原创粉丝点击