spring quartz 多定时任务
程序员文章站
2022-07-13 17:51:17
...
- <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定时任务 结束 -->
推荐阅读
-
定时任务 Wpf.Quartz.Demo.1
-
SpringBoot 定时任务的两种实现方法(Scheduled和quartz)以及InitializingBean接口的作用
-
Spring Boot使用@Scheduled 实现定时任务
-
spring基于注解的方式配置定时任务
-
基于spring+quartz的分布式定时任务框架实现
-
linux定时任务访问页面代替quartz集群_html/css_WEB-ITnose
-
Spring整合Quartz实现一个简单的定时任务
-
基于Quartz定时调度任务(详解)
-
SpringBoot与Quartz集成实现分布式定时任务集群的代码实例
-
spring boot定时任务接收邮件并且存储附件的方法讲解