`
CodeToMyLaw
  • 浏览: 7157 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Spring 定时器 (配置文件)

 
阅读更多
<?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>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics