<?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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- 版本定制化 -->
<bean id="reportJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="cn.hs.dpl.web.action.TimerAction" />
<property name="jobDataAsMap">
<map>
<entry key="menuService">
<ref bean="menuService"/>
</entry>
</map>
</property>
</bean>
<!--
CronTriggerBean指定工作的准确运行时间
-->
<bean id="cronReportTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="reportJob" />
<property name="cronExpression">
<!-- 设置每天晚上12点的时候,会自动进行版本的定制化 -->
<value>0 0 23 ? * *</value>
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronReportTrigger" />
</list>
</property>
</bean>
</beans>
Spring 定时器 (配置文件)
最新推荐文章于 2023-10-13 09:31:56 发布