spring定时器,执行多个任务

	<!-- ******************     spring定时任务 开始      ****************** -->
	
	<bean id="TaskAuto" class="cn.com.opendata.util.timer.TaskAuto">  
	    <property name="hastenManager">  
	        <ref bean="HqjcHasten_Poll"/>  
	    </property>  
	    <property name="depaUserManager">  
	        <ref bean="HqjcDepaUsers_Poll"/>  
	    </property>
	</bean>
	
	<!-- 月报 -->
	<bean id="yueBaoDetail"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="TaskAuto" />
		</property>
		<property name="targetMethod">
			<value>yueBao</value>
		</property>
	</bean>
	<bean id="yueBaoTrigger"
		class="org.springframework.scheduling.quartz.CronTriggerBean">
		<property name="jobDetail">
			<ref bean="yueBaoDetail"/>
		</property>
		<property name="cronExpression">
			<!-- 每个月15日晚23点整 -->
			<value>0 0 23 15 * ?</value>
<!--			<value>0/10 * * * * ?</value>-->
		</property>
	</bean>
	<!-- 季报 -->
	<bean id="jiBaoDetail"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="TaskAuto" />
		</property>
		<property name="targetMethod">
			<value>jiBao</value>
		</property>
	</bean>
	<bean id="jiBaoTrigger"
		class="org.springframework.scheduling.quartz.CronTriggerBean">
		<property name="jobDetail">
			<ref bean="jiBaoDetail"/>
		</property>
		<property name="cronExpression">
			<!-- 每年4月15日起每隔3个月晚23点 -->
			<value>0 0 23 15 4/3 ?</value>
		</property>
	</bean>
	<!-- 春节 -->
	<bean id="chunJieDetail"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="TaskAuto" />
		</property>
		<property name="targetMethod">
			<value>chunJie</value>
		</property>
	</bean>
	<bean id="chunJieTrigger"
		class="org.springframework.scheduling.quartz.CronTriggerBean">
		<property name="jobDetail">
			<ref bean="chunJieDetail"/>
		</property>
		<property name="cronExpression">
			<!-- 每年3月份最后一天晚23时 -->
			<value>0 0 23 L 3 ?</value>
		</property>
	</bean>
	<!-- 十一 -->
	<bean id="shiYiDetail"
		class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		<property name="targetObject">
			<ref bean="TaskAuto" />
		</property>
		<property name="targetMethod">
			<value>shiYi</value>
		</property>
	</bean>
	<bean id="shiYiTrigger"
		class="org.springframework.scheduling.quartz.CronTriggerBean">
		<property name="jobDetail">
			<ref bean="shiYiDetail"/>
		</property>
		<property name="cronExpression">
			<!-- 每年10月最后一天晚23时 -->
			<value>0 0 23 L 10 ?</value>
		</property>
	</bean>
	
	<!-- 任务列表 -->
	<bean
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers">
			<list>
				<ref local="yueBaoTrigger" /><!-- 月报 -->
				<ref local="jiBaoTrigger"/><!-- 季报 -->
<!--				<ref local="chunJieTrigger"/> 春节 -->
<!--				<ref local="shiYiTrigger"/> 十一 -->
			</list>
		</property>
	</bean>
	
	<!-- spring定时任务 结束  -->

 

你可能感兴趣的:(spring,bean,quartz)