This is the form of my project
src
main
ressources
applicationContext.xml
target
upload
pharmacies.txt
And this is the Spring Batch Reader
<property name="resource" value="./upload/pharmacies.txt" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="delimiter" value=","/>
<property name="names" value="nom,telephone,adresse,Latitude,Longitude" />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper">
<property name="targetType" value="model.Pharmacie" />
</bean>
</property>
</bean>
</property>
</bean>
this is the batch that I run
public class BatchPharmacie {
public static void main (String [] args) throws Exception {
ClassPathXmlApplicationContext cpt = new ClassPathXmlApplicationContext("applicationContext.xml");
//cpt.start();
JobLauncher jobLauncher = (JobLauncher) cpt.getBean("jobLauncher");
Job job = (Job) cpt.getBean("importPharmacies");
//JobParameters parameter = new JobParametersBuilder().addDate("date", new Date())
// .addString("input.file", "C:/envdev/travail/in/personnes.txt").toJobParameters();
jobLauncher.run(job, new JobParameters());
}
}
And I get this error
java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): class path resource