|
|
|
|
@@ -1,9 +1,9 @@
|
|
|
|
|
<?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"
|
|
|
|
|
<?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.5.xsd
|
|
|
|
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
|
|
|
|
|
@@ -12,154 +12,150 @@
|
|
|
|
|
<import resource="data-source-context.xml" />
|
|
|
|
|
|
|
|
|
|
<!-- register the step scope with the application context -->
|
|
|
|
|
<bean id="stepScope"
|
|
|
|
|
class="org.springframework.batch.execution.scope.StepScope" />
|
|
|
|
|
|
|
|
|
|
<bean id="jobConfigurationRegistryBeanPostProcessor" abstract="true"
|
|
|
|
|
class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
|
|
|
|
|
<property name="jobConfigurationRegistry"
|
|
|
|
|
ref="jobConfigurationRegistry" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobLauncher"
|
|
|
|
|
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
<property name="jobExecutor" ref="jobExecutor" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobConfigurationRegistry"
|
|
|
|
|
class="org.springframework.batch.execution.configuration.MapJobRegistry" />
|
|
|
|
|
|
|
|
|
|
<aop:config>
|
|
|
|
|
<aop:advisor
|
|
|
|
|
pointcut="execution(* org.springframework.batch.execution..*Repository+.*(..))"
|
|
|
|
|
advice-ref="txAdvice" />
|
|
|
|
|
</aop:config>
|
|
|
|
|
|
|
|
|
|
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
|
|
|
<tx:attributes>
|
|
|
|
|
<tx:method name="*Create*" propagation="REQUIRES_NEW" isolation="SERIALIZABLE"/>
|
|
|
|
|
<tx:method name="*"/>
|
|
|
|
|
</tx:attributes>
|
|
|
|
|
</tx:advice>
|
|
|
|
|
|
|
|
|
|
<bean id="jobExecutor"
|
|
|
|
|
class="org.springframework.batch.execution.job.DefaultJobExecutor">
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="stepExecutor"
|
|
|
|
|
class="org.springframework.batch.execution.step.simple.SimpleStepExecutor"
|
|
|
|
|
scope="prototype">
|
|
|
|
|
<property name="transactionManager" ref="transactionManager" />
|
|
|
|
|
<property name="repository" ref="jobRepository" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobRepository"
|
|
|
|
|
class="org.springframework.batch.execution.repository.SimpleJobRepository">
|
|
|
|
|
<constructor-arg ref="jobDao" />
|
|
|
|
|
<constructor-arg ref="stepDao" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.JdbcJobDao">
|
|
|
|
|
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
|
|
|
|
<property name="jobIncrementer" ref="jobIncrementer" />
|
|
|
|
|
<property name="jobExecutionIncrementer"
|
|
|
|
|
ref="jobExecutionIncrementer" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="stepDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.JdbcStepDao">
|
|
|
|
|
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
|
|
|
|
<property name="stepIncrementer" ref="stepIncrementer" />
|
|
|
|
|
<property name="stepExecutionIncrementer"
|
|
|
|
|
ref="stepExecutionIncrementer" />
|
|
|
|
|
<property name="jobDao" ref="jobDao" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="stepScope"
|
|
|
|
|
class="org.springframework.batch.execution.scope.StepScope" />
|
|
|
|
|
|
|
|
|
|
<bean id="jobConfigurationRegistryBeanPostProcessor" abstract="true"
|
|
|
|
|
class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
|
|
|
|
|
<property name="jobConfigurationRegistry"
|
|
|
|
|
ref="jobConfigurationRegistry" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobLauncher"
|
|
|
|
|
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
<property name="jobExecutor" ref="jobExecutor" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobConfigurationRegistry"
|
|
|
|
|
class="org.springframework.batch.execution.configuration.MapJobRegistry" />
|
|
|
|
|
|
|
|
|
|
<aop:config>
|
|
|
|
|
<aop:advisor
|
|
|
|
|
pointcut="execution(* org.springframework.batch.execution..*Repository+.*(..))"
|
|
|
|
|
advice-ref="txAdvice" />
|
|
|
|
|
</aop:config>
|
|
|
|
|
|
|
|
|
|
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
|
|
|
<tx:attributes>
|
|
|
|
|
<tx:method name="*Create*" propagation="REQUIRES_NEW"
|
|
|
|
|
isolation="SERIALIZABLE" />
|
|
|
|
|
<tx:method name="*" />
|
|
|
|
|
</tx:attributes>
|
|
|
|
|
</tx:advice>
|
|
|
|
|
|
|
|
|
|
<bean id="jobExecutor"
|
|
|
|
|
class="org.springframework.batch.execution.job.DefaultJobExecutor">
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobRepository"
|
|
|
|
|
class="org.springframework.batch.execution.repository.SimpleJobRepository">
|
|
|
|
|
<constructor-arg ref="jobDao" />
|
|
|
|
|
<constructor-arg ref="stepDao" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="jobDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.JdbcJobDao">
|
|
|
|
|
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
|
|
|
|
<property name="jobIncrementer" ref="jobIncrementer" />
|
|
|
|
|
<property name="jobExecutionIncrementer"
|
|
|
|
|
ref="jobExecutionIncrementer" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="stepDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.JdbcStepDao">
|
|
|
|
|
<property name="jdbcTemplate" ref="jdbcTemplate" />
|
|
|
|
|
<property name="stepIncrementer" ref="stepIncrementer" />
|
|
|
|
|
<property name="stepExecutionIncrementer"
|
|
|
|
|
ref="stepExecutionIncrementer" />
|
|
|
|
|
<property name="jobDao" ref="jobDao" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="mapJobDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.MapJobDao"/>
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.MapJobDao" />
|
|
|
|
|
|
|
|
|
|
<bean id="mapStepDao" lazy-init="true"
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.MapStepDao"/>
|
|
|
|
|
class="org.springframework.batch.execution.repository.dao.MapStepDao" />
|
|
|
|
|
|
|
|
|
|
<bean id="jdbcTemplate"
|
|
|
|
|
class="org.springframework.jdbc.core.JdbcTemplate">
|
|
|
|
|
<property name="dataSource" ref="dataSource" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="simpleJob"
|
|
|
|
|
class="org.springframework.batch.core.domain.Job"
|
|
|
|
|
abstract="true">
|
|
|
|
|
<property name="restartable" value="true" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="simpleStep"
|
|
|
|
|
class="org.springframework.batch.execution.step.simple.SimpleStep"
|
|
|
|
|
abstract="true">
|
|
|
|
|
<property name="allowStartIfComplete" value="true" />
|
|
|
|
|
<bean id="jdbcTemplate"
|
|
|
|
|
class="org.springframework.jdbc.core.JdbcTemplate">
|
|
|
|
|
<property name="dataSource" ref="dataSource" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="simpleJob"
|
|
|
|
|
class="org.springframework.batch.core.domain.Job" abstract="true">
|
|
|
|
|
<property name="restartable" value="true" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="abstractStep" abstract="true">
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
<property name="transactionManager" ref="transactionManager" />
|
|
|
|
|
<property name="allowStartIfComplete" value="true" />
|
|
|
|
|
<property name="saveRestartData" value="false" />
|
|
|
|
|
<property name="jobRepository" ref="jobRepository"/>
|
|
|
|
|
<property name="transactionManager" ref="transactionManager"/>
|
|
|
|
|
<property name="exceptionHandler">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.repeat.exception.handler.SimpleLimitExceptionHandler">
|
|
|
|
|
<property name="limit" value="5" />
|
|
|
|
|
<property name="useParent" value="true" />
|
|
|
|
|
</bean>
|
|
|
|
|
</property>
|
|
|
|
|
<property name="commitInterval" value="1" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="repeatOperationsStep"
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="simpleStep" parent="abstractStep"
|
|
|
|
|
class="org.springframework.batch.execution.step.simple.SimpleStep"
|
|
|
|
|
abstract="true">
|
|
|
|
|
<property name="exceptionHandler">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.repeat.exception.handler.SimpleLimitExceptionHandler">
|
|
|
|
|
<property name="limit" value="5" />
|
|
|
|
|
<property name="useParent" value="true" />
|
|
|
|
|
</bean>
|
|
|
|
|
</property>
|
|
|
|
|
<property name="commitInterval" value="1" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="repeatOperationsStep" parent="abstractStep"
|
|
|
|
|
class="org.springframework.batch.execution.step.simple.RepeatOperationsStep"
|
|
|
|
|
abstract="true">
|
|
|
|
|
<property name="allowStartIfComplete" value="true" />
|
|
|
|
|
<property name="saveRestartData" value="false" />
|
|
|
|
|
<property name="jobRepository" ref="jobRepository"/>
|
|
|
|
|
<property name="transactionManager" ref="transactionManager"/>
|
|
|
|
|
<property name="jobRepository" ref="jobRepository" />
|
|
|
|
|
<property name="transactionManager" ref="transactionManager" />
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="customEditorConfigurer"
|
|
|
|
|
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
|
|
|
|
<property name="customEditors">
|
|
|
|
|
<map>
|
|
|
|
|
<entry key="int[]">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.support.IntArrayPropertyEditor" />
|
|
|
|
|
</entry>
|
|
|
|
|
<entry
|
|
|
|
|
key="org.springframework.batch.io.file.transform.Range[]">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.io.file.transform.RangeArrayPropertyEditor" />
|
|
|
|
|
</entry>
|
|
|
|
|
<entry key="java.util.Date">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.beans.propertyeditors.CustomDateEditor">
|
|
|
|
|
<constructor-arg>
|
|
|
|
|
<bean class="java.text.SimpleDateFormat">
|
|
|
|
|
<constructor-arg value="yyyyMMdd" />
|
|
|
|
|
</bean>
|
|
|
|
|
</constructor-arg>
|
|
|
|
|
<constructor-arg value="false" />
|
|
|
|
|
</bean>
|
|
|
|
|
</entry>
|
|
|
|
|
</map>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="itemProcessorLogAdvice"
|
|
|
|
|
class="org.springframework.batch.sample.advice.ProcessorLogAdvice" />
|
|
|
|
|
|
|
|
|
|
<aop:config>
|
|
|
|
|
<aop:aspect id="moduleLogging" ref="itemProcessorLogAdvice">
|
|
|
|
|
|
|
|
|
|
<aop:after
|
|
|
|
|
pointcut="execution( * org.springframework.batch.item.ItemWriter+.write(Object)) and args(item)"
|
|
|
|
|
method="doStronglyTypedLogging" />
|
|
|
|
|
|
|
|
|
|
</aop:aspect>
|
|
|
|
|
</aop:config>
|
|
|
|
|
|
|
|
|
|
</beans>
|
|
|
|
|
<bean id="customEditorConfigurer"
|
|
|
|
|
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
|
|
|
|
<property name="customEditors">
|
|
|
|
|
<map>
|
|
|
|
|
<entry key="int[]">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.support.IntArrayPropertyEditor" />
|
|
|
|
|
</entry>
|
|
|
|
|
<entry
|
|
|
|
|
key="org.springframework.batch.io.file.transform.Range[]">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.batch.io.file.transform.RangeArrayPropertyEditor" />
|
|
|
|
|
</entry>
|
|
|
|
|
<entry key="java.util.Date">
|
|
|
|
|
<bean
|
|
|
|
|
class="org.springframework.beans.propertyeditors.CustomDateEditor">
|
|
|
|
|
<constructor-arg>
|
|
|
|
|
<bean class="java.text.SimpleDateFormat">
|
|
|
|
|
<constructor-arg value="yyyyMMdd" />
|
|
|
|
|
</bean>
|
|
|
|
|
</constructor-arg>
|
|
|
|
|
<constructor-arg value="false" />
|
|
|
|
|
</bean>
|
|
|
|
|
</entry>
|
|
|
|
|
</map>
|
|
|
|
|
</property>
|
|
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
<bean id="itemProcessorLogAdvice"
|
|
|
|
|
class="org.springframework.batch.sample.advice.ProcessorLogAdvice" />
|
|
|
|
|
|
|
|
|
|
<aop:config>
|
|
|
|
|
<aop:aspect id="moduleLogging" ref="itemProcessorLogAdvice">
|
|
|
|
|
|
|
|
|
|
<aop:after
|
|
|
|
|
pointcut="execution( * org.springframework.batch.item.ItemWriter+.write(Object)) and args(item)"
|
|
|
|
|
method="doStronglyTypedLogging" />
|
|
|
|
|
|
|
|
|
|
</aop:aspect>
|
|
|
|
|
</aop:config>
|
|
|
|
|
|
|
|
|
|
</beans>
|
|
|
|
|
|