<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
default-autowire="no" default-lazy-init="false">
<bean id="someData" class="com.spring.job.JobData"/>
<bean id="jobDetailBean"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass"
value="com.spring.job.DemoJob"/>
<property name="jobDataAsMap">
<map>
<entry key="jobData" value-ref="someData"/>
</map>
</property>
</bean>
<bean id="jobDetailBean2"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass"
value="com.spring.job.DemoJob2"/>
<property name="jobDataAsMap">
<map>
<entry key="jobData" value-ref="someData"/>
</map>
</property>
</bean>
<bean id="simpleTriggerBean"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetailBean"/>
<property name="repeatInterval" value="500000"/>
<property name="startDelay" value="10000"/>
</bean>
<bean id="simpleTriggerBean2"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetailBean2"/>
<property name="repeatInterval" value="100000"/>
<property name="startDelay" value="10000"/>
</bean>
<bean id="schedulerFactoryBean"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTriggerBean"/>
<ref bean="simpleTriggerBean2"/>
</list>
</property>
</bean>
</beans>
Spring 集成Quartz的XML配置
最新推荐文章于 2025-01-01 22:12:41 发布
本文介绍了一个使用Spring框架和Quartz实现的任务调度配置案例。其中包括定义了两个不同的任务(DemoJob和DemoJob2),并为每个任务配置了不同的触发器(simpleTriggerBean和simpleTriggerBean2)。此外,还设置了任务的重复间隔和启动延迟。

9128

被折叠的 条评论
为什么被折叠?



