<?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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
default-lazy-init="false" default-autowire="no">
<bean id="dsrw" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- 第一个任务 -->
<ref local="rw1" />
<!-- 第二个任务 -->
<ref local="rw2"/>
</list>
</property>
</bean>
<!-- 第一个任务 -->
<bean id="rw1" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="gt1" />
</property>
<property name="cronExpression">
<value>0 58 14 * * ?</value>
</property>
</bean>
<bean id="gt1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="gt2" />
</property>
<property name="targetMethod">
<value>执行类的方法名</value>
</property>
</bean>
<bean id="gt2" class="执行类的路径" >
<property name="dingdanService">
<ref bean="dingdanService"/>
</property>
</bean>
<!-- 第二个任务 -->
<bean id="rw2" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="grw1" />
</property>
<property name="cronExpression">
<value>0 0 0,12 * * ?</value>
</property>
</bean>
<bean id="grw1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="grw2"/>
</property>
<property name="targetMethod">
<value>类中方法名</value>
</property>
</bean>
<bean id="grw2" class="类路径" >
</bean>
</beans>
Spring的quart(定时任务)配置文件
最新推荐文章于 2023-02-15 09:36:32 发布
本文介绍了一个使用Spring框架配置两个基于Cron表达式的定时任务的例子。详细展示了如何定义触发器、作业细节以及关联的服务对象。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Llama Factory
模型微调
LLama-Factory
LLaMA Factory 是一个简单易用且高效的大型语言模型(Large Language Model)训练与微调平台。通过 LLaMA Factory,可以在无需编写任何代码的前提下,在本地完成上百种预训练模型的微调
851

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



