I want to configure spring-batch
to read all csv
files inside a specific folder sequentially.
The following does not work because the deleg
Use PathMatchingResourcePatternResolver like this.
@Bean
public ItemReader reader() {
Resource[] resources = null;
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
try {
resources = patternResolver.getResources("/myfolder/*.csv");
} catch (IOException e) {
e.printStackTrace();
}
MultiResourceItemReader reader = new MultiResourceItemReader<>();
reader.setResources(resources);
reader.setDelegate(new FlatFileItemReader<>(..));
return reader;
}