본문 바로가기
Spring

Spring Quartz 1-2

by 아이티.파머 2010. 12. 14.
반응형
<?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="sdTimerQuartz" class="com.dongbu.farm.system.schedule.SDTimerQuartz"></bean>
       <bean name="businessJobTimer" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" >
<value>com..dongbu.farm.schedule.que.ExampleJob</value>
</property>
<property name="jobDataAsMap">
  <map>
    <entry key="timeout" value="5" /><!-- 5 sec-->
  </map>
</property>
</bean>
<bean id="employTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
    <!--//see the example of method invoking job above  1초 늦게 실행해서 매 5초마다 실행 --> 
    <property name="jobDetail" ref="businessJobTimer" />
    <!--//1 seconds  -->
    <property name="startDelay" value="1000" />
    <!--// repeat every 5 seconds -->
    <property name="repeatInterval" value="5000" />
</bean>


<bean id="sdMethodInvokingJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="sdTimerQuartz"      />
<property name="targetMethod" value="init"  />
<property name="concurrent"   value="false"      />
</bean>
<bean id="sdCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="sdMethodInvokingJobDetail" />
    <property name="cronExpression" value="0 0 5 * * ?" /><!-- run every morning at 5 AM -->
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="employTrigger" />
            <ref bean="sdCronTrigger" />
        </list>
    </property>
</bean>
</beans>


반응형

'Spring' 카테고리의 다른 글

spring annotation  (0) 2011.03.30
Spring Annotation 사용방법  (0) 2011.03.14
Spring Quartz 1-1  (0) 2010.12.14
Spring Timer Sample  (0) 2010.12.14
Ibitis ResultMap XML 자동 생성하기.  (0) 2010.09.14