factory.setItemReader(reader);
JobRepositoryFactoryBean repositoryFactory = new JobRepositoryFactoryBean();
repositoryFactory.setDataSource(dataSource);
repositoryFactory.setTransactionManager(transactionManager);
repositoryFactory.afterPropertiesSet();
JobRepository repository = repositoryFactory.getObject();
factory.setJobRepository(repository);
JobExecution jobExecution = repository.createJobExecution("job", new JobParameters());
StepExecution stepExecution = jobExecution.createStepExecution(factory.getName());