java - spring batch FlatFileItemReader wraps item with square bracket e.g. [item]? -


I have the format below the file. Each line contains a single item. E.g.

  RIC1RIC2RIC3 . I am using FlatFileItemReader to read these items. This configuration is  
  & lt; Beans: Bean id = "myLineMapper" class = "com.st.batch.foundation.MyLineMapper" /> & Lt; Bean: Bean id = "MyFileMederer" class = "org.springframework.batch.item.file.FlatFileItemReader" p: resource = "file: $ {spring.tmp.batch.dir} / somename - # {JobPermatators [date]} / Items.txt "p: lineMapper-ref =" myLineMapper "scope =" step "/>   

This is my line mapper,

  public class MyLineMapper is applicable on LineMon & lt; List & lt; String & gt; & Gt; {Public listing & lt; String & gt; mapLine (string line, intline number) exception {list & lt; String & gt; List = New Arrestist & lt; String & gt; (); List.add (line.trim ()); Return list; }}   

In my item author, I'm getting wrapped items with square brackets. I do not know where this bracket has been added?

  Public Square Import Exchange Item Water & lt; T & gt; Applicable item deadline & lt; T & gt; {Enter public zeros (list increments items?) Exceptions thrown (t items: items) {System.out.println (item); }}   

The output is below:

  [RIC1] [RIC 2] [RIC 3]. .   

How many of these brackets have been added to the item? Is there any way to remove it?

This is happening because you want to list FieldSetMapper To map content, you want to see the first and only element.

  apply the public class MyFieldSetMapper FieldSetMapper & lt; String & gt; {@ Override public string mapfilldet (FieldSet FieldSet) throws the Bindai extension {String MyITIm = FieldSet. String (0); Return IITs; }}   

and use DefaultLineMapper in the XML config that is expecting a FieldSetMapper : < Pre> & lt; Been Name = "Sample Limemiper" class = "org.springframework.batch.item.file.mapping.DefaultLineMapper" & gt; & Lt; Property Name = "fieldSetMapper" ref = "Sample Sampler" /> & Lt; Property Name = "LineTokenizer" ref = "Sampling Linenetizer" /> & Lt; / Bean & gt; & Lt; bean name = "sampleLineTokenizer" class = "org.springframework.batch.item.file.transform.DelimitedLineTokenizer" /> & Lt; Bean's Name = "Sample Nemper" class = "path.to.MyFieldSetMapper" />

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -