欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

spring quartz定时任务 quartzSpringJavaXML 

程序员文章站 2024-02-26 09:04:22
...

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	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.xsd">
 
	<bean id="scheduler"
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers">
			<list>
			<!--  
				<ref local="IssureNoticeTrigger" /> 
				<ref local="LotStateNoticeTrigger" />
				<ref local="LotWinNoticeTrigger" />
				-->
			</list>
		</property>
	</bean>

 

	<bean id="IssureNoticeTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
		<property name="startDelay" value="10000"/>
		<property name="repeatInterval" value="180000" />
		<property name="jobDetail">
			<bean
				class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
				<property name="targetObject" ref="IssureNotice" />//目标类
				<property name="targetMethod" value="render" />//类中的方法
			</bean>
		</property>
	</bean>

	<bean id="LotStateNoticeTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
		<property name="startDelay" value="10000" />
		<property name="repeatInterval" value="180000" />
		<property name="jobDetail">
			<bean
				class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
				<property name="targetObject" ref="LotStateNotice" />
				<property name="targetMethod" value="render" />
			</bean>
		</property>
	</bean>

	<bean id="LotWinNoticeTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
		<property name="startDelay" value="10000" />
		<property name="repeatInterval" value="180000" />
		<property name="jobDetail">
			<bean
				class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
				<property name="targetObject" ref="LotWinNotice" />
				<property name="targetMethod" value="render" />
			</bean>
		</property>
	</bean>

</beans>