public class TaskJobLauncherCommandLineRunner extends Object implements org.springframework.boot.CommandLineRunner, org.springframework.core.Ordered, org.springframework.context.ApplicationEventPublisherAware
CommandLineRunner
to launch
Spring Batch jobs. Runs all
jobs in the surrounding context by default and throw an exception upon the
first job that returns an ExitStatus
of FAILED.
Can also be used to launch a specific job by providing a jobName. The
TaskJobLaunchercommandLineRunner takes the place of the
JobLauncherCommandLineRunner
when it is in use.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ORDER
The default order for the command line runner.
|
Constructor and Description |
---|
TaskJobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher,
org.springframework.batch.core.explore.JobExplorer jobExplorer) |
Modifier and Type | Method and Description |
---|---|
protected void |
execute(org.springframework.batch.core.Job job,
org.springframework.batch.core.JobParameters jobParameters) |
int |
getOrder() |
protected void |
launchJobFromProperties(Properties properties) |
void |
run(String... args) |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher) |
void |
setJobNames(String jobNames) |
void |
setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter) |
void |
setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry) |
void |
setJobs(Collection<org.springframework.batch.core.Job> jobs) |
void |
setOrder(int order) |
public static final int DEFAULT_ORDER
public TaskJobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer)
public void setOrder(int order)
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
setApplicationEventPublisher
in interface org.springframework.context.ApplicationEventPublisherAware
public void setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)
public void setJobNames(String jobNames)
public void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter)
public void setJobs(Collection<org.springframework.batch.core.Job> jobs)
public void run(String... args) throws org.springframework.batch.core.JobExecutionException
run
in interface org.springframework.boot.CommandLineRunner
org.springframework.batch.core.JobExecutionException
protected void launchJobFromProperties(Properties properties) throws org.springframework.batch.core.JobExecutionException
org.springframework.batch.core.JobExecutionException
protected void execute(org.springframework.batch.core.Job job, org.springframework.batch.core.JobParameters jobParameters) throws org.springframework.batch.core.repository.JobExecutionAlreadyRunningException, org.springframework.batch.core.repository.JobRestartException, org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException, org.springframework.batch.core.JobParametersInvalidException, org.springframework.batch.core.launch.JobParametersNotFoundException
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
org.springframework.batch.core.repository.JobRestartException
org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException
org.springframework.batch.core.JobParametersInvalidException
org.springframework.batch.core.launch.JobParametersNotFoundException
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.