Code: Select all
8161 [01 Aug 2023 12:25:02.580] ERROR server01 [main] org.springframework.batch.core.step.AbstractStep - Encountered an error executing step step in job importUserJob
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.reader' defined in class path resource [com/batch/BatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.beanio.spring.BeanIOFlatFileItemReader]: Factory method 'reader' threw exception; nested exception is java.lang.IllegalArgumentException: Path must not be null
Code: Select all
@Bean
@StepScope
public BeanIOFlatFileItemReader reader(@Value("#{jobParameters['filePath']}") String filePath) {
BeanIOFlatFileItemReader reader = new BeanIOFlatFileItemReader();
reader.setUseSpringExceptions(true);
reader.setResource(new FileSystemResource(filePath));
reader.setStreamName(inputContactStreamName);
reader.setStreamMapping(new ClassPathResource(beanIoConfigurationXmlPath));
reader.setStreamFactory(StreamFactory.newInstance());
reader.getLineNumber();
return reader;
}