How to read files from s3 directly from FlatFileItemReader.
below is my FileItemreader. I am using java annotation . I followed the below link http://cloud.spring.io/spring-cloud-aws/spring-cloud-aws.html#_resource_handling
code
public static FlatFileItemReader<Person> reader( String filenameStandard) {
FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
reader.setLinesToSkip(1);
System.out.println("Job parameter ++++++++++++++++++++++"+filenameStandard);
//working configuration with ClassPathResource
//reader.setResource(new ClassPathResource(filenameStandard));
/* String location= "s3://"+ "iebr-input"+"/" +"test_data.csv";
reader.setResource(new AmazonS3Resource(amazonS3ClientInitializer, "iebr-input", "test_data.csv"));*/
reader.setRecordSeparatorPolicy(new DefaultRecordSeparatorPolicy());
reader.setLineMapper(new DefaultLineMapper<Person>() {
{
setLineTokenizer(new DelimitedLineTokenizer() {
{
// setNames(new String[] { "id", "firstName", "lastName" ,"harmScore", "removabilityScore", "kowScore"});
setNames(new String[] {"case", "name", "ccd_case", "date_of_birth", "family", "fullname"
});
}
});
setFieldSetMapper(new BeanWrapperFieldSetMapper<Person>() {
{
setTargetType(Person.class);
}
});
}
});
return reader;
}