@Component public class JobLauncherCommandLineRunner extends Object implements CommandLineRunner, ApplicationEventPublisherAware
CommandLineRunner
to launch
Spring Batch jobs. Runs all
jobs in the surrounding context by default. Can also be used to launch a specific job
by providing a jobNameConstructor and Description |
---|
JobLauncherCommandLineRunner(JobLauncher jobLauncher,
JobExplorer jobExplorer) |
Modifier and Type | Method and Description |
---|---|
protected void |
execute(Job job,
JobParameters jobParameters) |
protected void |
launchJobFromProperties(Properties properties) |
void |
run(String... args)
Callback used to run the bean.
|
void |
setApplicationEventPublisher(ApplicationEventPublisher publisher) |
void |
setJobNames(String jobNames) |
void |
setJobParametersConverter(JobParametersConverter converter) |
void |
setJobRegistry(JobRegistry jobRegistry) |
void |
setJobs(Collection<Job> jobs) |
public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer)
public void setJobNames(String jobNames)
public void setApplicationEventPublisher(ApplicationEventPublisher publisher)
setApplicationEventPublisher
in interface ApplicationEventPublisherAware
@Autowired(required=false) public void setJobRegistry(JobRegistry jobRegistry)
@Autowired(required=false) public void setJobParametersConverter(JobParametersConverter converter)
@Autowired(required=false) public void setJobs(Collection<Job> jobs)
public void run(String... args) throws JobExecutionException
CommandLineRunner
run
in interface CommandLineRunner
args
- incoming main method argumentsJobExecutionException
protected void launchJobFromProperties(Properties properties) throws JobExecutionException
JobExecutionException
protected void execute(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException, JobParametersNotFoundException
JobExecutionAlreadyRunningException
JobRestartException
JobInstanceAlreadyCompleteException
JobParametersInvalidException
JobParametersNotFoundException
Copyright © 2014. All rights reserved.