간단 테스트


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 
 <description>Monitor Job</description>
 <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
  <property name="jobRepository" ref="jobRepository"/>
 </bean>
  
 <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
  p:databaseType="mysql">
  <property name="dataSource" ref="dataSource"/>
  <property name="transactionManager" ref="transactionManager"/>
 </bean>
  
 <bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob"
  abstract="true"  p:restartable="true">
  <property name="jobRepository" ref="jobRepository"/>
 </bean>
  
 <bean id="taskletStep" class="org.springframeworkbatch.core.step.tasklet.TaskletStep"
  abstract="true" p:jobRepository-ref="jobRepository" />
 
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://119.205.238.214:3306/monitor_batch" />
  <property name="username" value="dejava" />
  <property name="password" value="vpfmak12" />
 </bean>
 
 <bean id="transactionManager"
  class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
  lazy-init="true" p:dataSource-ref="dataSource" />

 <bean id="myHelloJob" parent="simpleJob">
  <property name="name" value="myHelloJob" />
  <property name="steps">
   <list>
    <bean id="firstHello" parent="taskletStep">
     <property name="tasklet">
      <bean class="com.nhncorp.laputa.monitor.batch.SimpleJob">
       <property name="message" value="Oh~ Hi~ Kim Yong Hwan" />
      </bean>
     </property>
    </bean>
   
    <bean id="secondHello" parent="taskletStep">
     <property name="tasklet">
      <bean class="com.nhncorp.laputa.monitor.batch.SimpleJob">
       <property name="message" value="Come on~" />
      </bean>
     </property>
    </bean>
   </list>
  </property>
 </bean>

 <bean id="helloJob" class="org.springframework.scheduling.quartz.JobDetailBean">
  <property name="jobClass" value="com.nhncorp.laputa.monitor.batch.JobWorker" />
  <property name="jobDataAsMap">
   <map>
    <entry key="launcher" value-ref="jobLauncher"/>
    <entry key="job" value-ref="myHelloJob"/>
   </map>
  </property>
 </bean>
 
 <bean id="batchLogCleaningJob" class="org.springframework.scheduling.quartz.JobDetailBean">
  <property name="jobClass" value="com.nhncorp.laputa.monitor.batch.JobWorker" />
  <property name="jobDataAsMap">
   <map>
    <entry key="launcher" value-ref="jobLauncher"/>
    <entry key="job" value-ref="myHelloJob"/>
   </map>
  </property>
 </bean>
 
 <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
  <property name="jobDetail" ref="helloJob" />
  <property name="startDelay" value="10000" />
  <property name="repeatInterval" value="50000" />
 </bean>
 
 <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
   <property name="jobDetail" ref="batchLogCleaningJob"/>
  <!-- run every morning at 0 AM -->
  <!-- TODO : Batch Job clean every day -->
   <property name="cronExpression" value="0 0 0 * * ?"/>
 </bean>
 
 <!--  Scheduler Initialization   -->
 <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  <property name="triggers">
   <list>
    <ref bean="simpleTrigger"/>
    <ref bean="cronTrigger"/>
   </list>
  </property>
 </bean>
 
 
 
</beans>

 

 


'Trend' 카테고리의 다른 글

구글 안드로이드의 전략  (0) 2009.03.18
Podcasting 공부 싸이트  (0) 2009.03.09
Flex와 Java 연동 관련  (0) 2009.02.19
EDOS (Economic Denial of Sustainability) 출현  (0) 2009.02.05
FIDC (FDIC: Federal Deposit Insurance Corporation)  (0) 2008.11.25
Posted by '김용환'
,