Spring batch Input resource must exist (reader is in 'strict' mode) error

I had find the same problem and i'd use org.springframework.core.io.FileSystemResource class like this: file: c:\data\geodata1.csv reader.setResource(new FileSystemResource(file));


use PathResource from org.springframework.core.io , it worked for me

@Bean
@StepScope
public FlatFileItemReader<CourseCountry> reader(@Value("#{jobParameters[fullPathFileName]}") String pathToFile) {
    return new FlatFileItemReaderBuilder<CourseCountry>()
      .name("studentItemReader")        
      .resource(new PathResource(pathToFile))
      .lineMapper(lineMapper())
      .linesToSkip(1)
      .build();
}

Just found the solution use org.springframework.core.io.UrlResource; class instead of org.springframework.core.io.ClassPathResource;