Srping 定时调度services注入

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>   
  	<!-- 定义调用对象和调用对象的方法 -->
	<bean id="jobtask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
	    <!-- 调用的类 -->
	    <property name="targetObject">
	        <bean class="com.business.card.data.action.ImportFileQuart">  
                <!-- ImportFileQuart类注入的Service -->
            <property name="iportfileService" ref="IportfileService"></property>
			<property name="paramService" ref="ParamService"></property>
			<property name="interfaceCardService" ref="InterfaceCardService"></property>
			<property name="interfaceDealcardService" ref="InterfaceDealcardService"></property>
			<property name="cardService" ref="CardService"></property>
			<property name="dealCarService" ref="DealCarService"></property>
        </bean>
	    </property>
	    <!-- 调用类中的方法 -->
	    <property name="targetMethod">
	        <value>execQuart</value>
	    </property>
	</bean>
	
	<!-- 定义触发时间 -->
	<bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
	    <property name="jobDetail">
	        <ref bean="jobtask"/>
	    </property>
	    <!-- cron表达式 -->
	    <property name="cronExpression">
	        <value>0 52 08 ? * *</value><!--每天8点52触发--> 
	    </property>
	</bean>
	
	<!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序  -->
	<bean id="startQuertz" lazy-init="false" autowire="no" 
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
	    <property name="triggers">
	        <list>
	            <ref bean="doTime"/>
	        </list>
	    </property>
	</bean>	
</beans>

你可能感兴趣的:(spring,bean,xml)