LineTokenizer in FlatFileItemReader
It looks like the LineTokenizer was removed from the FlatFileItemReader in 2.0, based on the updated documentation (http://static.springframework.org/sp...temReader.html ), but the User Guide and samples still seem to say that's how I tokenize lines in 2.0 (ref http://static.springframework.org/sp...s.html#d0e4219 and http://static.springframework.org/sp....html#football ). When I try to use it as the user guide and samples show, I get the following exception:
Code:
org.springframework.beans.NotWritablePropertyException: Invalid property 'lineTokenizer' of bean class [org.springframework.batch.item.file.FlatFileItemReader]: Bean property 'lineTokenizer' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Here's the reader I'm creating:
Code:
<bean id="pubFinIdItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
<property name="resource" value="file:/#{jobParameters[srcDir]}/#{jobParameters[fileName]}" />
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="delimiter" value="|"/>
<property name="names" value="publ_id,fin_id" />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="com.me.batch.mapping.PubFinIdDataMapping" >
<property name="invalidFinDataWriter" ref="invalidFinDataWriter" />
</bean>
</property>
</bean>
I've looked all over, and can only find this as the method of doing what I want to do - grab the lines from the file and tokenize them. How do I do this now in 2.0? What am I missing?
Thanks!
How do i give a Line Tokenizer for a flatfileItemReader in Springbatch 2.0.
How do i give a Line Tokenizer for a flatfileItemReader in Springbatch 2.0.
Unable to give LineTokenizer.Please help
<bean id="itemReader" class="org.springframework.batch.item.file.FlatFil eItemReader">
<property name="resource" value="file:./hello.txt" />
<property name="lineMapper" ref="lineMapper" />
</bean>
<bean id="lineMapper"
class="org.springframework.batch.item.file.mapping .DefaultLineMapper">
<property name="tokenizer" ref="tokenizer" />
<property name="fieldSetMapper" ref="fieldSetMapper" />
</bean>
<bean id="tokenizer"
class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
<property name="delimiter" value="H"/>
</bean>
<bean id="fieldSetMapper"
class="org.springframework.batch.item.file.mapping .PassThroughFieldSetMapper" />