jobs.compositeItemWriterSampleJob.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-batch-samples
Show all versions of spring-batch-samples
Example batch jobs using Spring Batch Core and Execution.
<?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"> <bean id="compositeItemWriterJob" parent="simpleJob"> <property name="steps"> <bean id="step1" parent="simpleStep"> <property name="streams"> <list> <ref bean="fileItemReader" /> <ref bean="fileItemWriter" /> </list> </property> <property name="itemReader" ref="fileItemReader" /> <property name="itemProcessor"> <bean class="org.springframework.batch.item.validator.ValidatingItemProcessor"> <constructor-arg ref="fixedValidator" /> </bean> </property> <property name="itemWriter" ref="compositeWriter" /> </bean> </property> </bean> <!-- INFRASTRUCTURE SETUP --> <bean id="compositeWriter" class="org.springframework.batch.item.support.CompositeItemWriter"> <property name="delegates"> <list> <bean class="org.springframework.batch.sample.domain.trade.internal.TradeWriter"> <property name="dao" ref="tradeDao" /> </bean> <ref bean="fileItemWriter" /> </list> </property> </bean> <bean id="fileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader"> <property name="resource" value="classpath:data/fixedLengthImportJob/input/20070122.teststream.ImportTradeDataStep.txt" /> <property name="lineMapper"> <bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"> <property name="lineTokenizer" ref="fixedFileTokenizer" /> <property name="fieldSetMapper" ref="fieldSetMapper" /> </bean> </property> </bean> <bean id="fixedFileTokenizer" class="org.springframework.batch.item.file.transform.FixedLengthTokenizer"> <property name="names" value="ISIN, Quantity, Price, Customer" /> <property name="columns" value="1-12, 13-15, 16-20, 21-29" /> </bean> <bean id="fixedValidator" class="org.springframework.batch.item.validator.SpringValidator"> <property name="validator"> <bean id="tradeValidator" class="org.springmodules.validation.valang.ValangValidator"> <property name="valang"> <value> <![CDATA[ { isin : length(?) < 13 : 'ISIN too long' : 'isin_length' : 12} ]]> </value> </property> </bean> </property> </bean> <bean id="tradeDao" class="org.springframework.batch.sample.domain.trade.internal.JdbcTradeDao"> <property name="dataSource" ref="dataSource" /> <property name="incrementer"> <bean parent="incrementerParent"> <property name="incrementerName" value="TRADE_SEQ" /> </bean> </property> </bean> <bean class="org.springframework.batch.item.file.FlatFileItemWriter" id="fileItemWriter"> <property name="resource" value="file:target/test-outputs/20070122.testStream.ParallelCustomerReportStep.TEMP.txt" /> <property name="lineAggregator"> <bean class="org.springframework.batch.item.file.transform.PassThroughLineAggregator" /> </property> </bean> <bean id="fieldSetMapper" class="org.springframework.batch.sample.domain.trade.internal.TradeFieldSetMapper" /> </beans>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy