Follow the Sample (CSV file operation) of Spring Batch (iv)
The way to configure the good Csvitemreader,
It is very strange to find the data read, and by modifying the configuration file discovery,
Commit-interval , routines are no problem. If it is greater than 1, for example, set to 50, the 50th data will be read 50 times in.
Tracking code
Org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper
The Getbean () method is found when the configuration file is as follows
<Bean:propertyName= "Fieldsetmapper">
<bean:bean
Class= "Org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper" Span style= "color: #0000ff;" >>
<bean:property name= "Prototypebeanname" Value=" Student "> </bean:property>
</bean:bean>
</bean:property >
prototypebeanname causes the data read by chunk to be set to a unique specified bean, so only the last row of data read by chunk can be persisted in the bean.
Modify the way, use TargetType instead of prototypebeanname.
<!--property Name= "Prototypebeanname" value= "Mongodatahistory" ></property-->
<property name= "TargetType" value= "Entity Bean Class name" ></property>
Spring-batch CSV file read point of attention