Spring-batch CSV file read point of attention

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.