0

嗨,我在执行示例 Spring 批处理作业时遇到空指针异常。作业启动器抛出异常。这是我的工作启动器代码。提前致谢。

public class NewJobRunner {
public static Job job;
public static JobLauncher jobLauncher;
public static JobRepository jobRepository;

public static void main(String args[]) {
    try {
        AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("/resources/job-context.xml");
        jobLauncher.run(job, new JobParametersBuilder()
                    .toJobParameters()
        );
    }catch(Exception e) {
        e.printStackTrace();
    }

}

public void setJobLauncher(JobLauncher jobLauncher) {
    this.jobLauncher = jobLauncher;
}

public void setJobRepository(JobRepository jobRepository) {
    this.jobRepository = jobRepository;
}

public void setJob(Job job) {
    this.job = job;
}
4

0 回答 0