I ran into a problem when I have a CSV file with 10 columns and only selected columns are needed to display Java objects. However, the CSV is a header column, and the data position is fixed. Therefore, I know that only columns 1 to 3 are useful to me, and rest should be ignored. For example: CSV: A1, A2, A3, A4, A5, A6, A7, A8, A9, A10
I need to have columns A1 to A3 to map to my pojo. I am sure this is the wrong way, but I tried to do something like this, but it does not work. Spring batch is trying to match all column values with my pojo.
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names" value="Name,Department,Age,,,,,,," />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper">
<property name="prototypeBeanName" value="EmployeeDO" />
</bean>
I have not studied all the Spring functions, but is there something that can be easily achieved? Any help would be appreciated