Class JobLauncherCommandLineRunner
- java.lang.Object
- org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.boot.CommandLineRunner,org.springframework.context.ApplicationEventPublisherAware
public class JobLauncherCommandLineRunner extends Object implements org.springframework.boot.CommandLineRunner, org.springframework.context.ApplicationEventPublisherAware
CommandLineRunnertolaunchSpring Batch jobs. Runs all jobs in the surrounding context by default. Can also be used to launch a specific job by providing a jobName
Constructor Summary
Constructors Constructor Description JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecute(org.springframework.batch.core.Job job, org.springframework.batch.core.JobParameters jobParameters)protected voidlaunchJobFromProperties(Properties properties)voidrun(String... args)voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)voidsetJobNames(String jobNames)voidsetJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter)voidsetJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)voidsetJobs(Collection<org.springframework.batch.core.Job> jobs)
Constructor Detail
JobLauncherCommandLineRunner
public JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer)
Method Detail
setJobNames
public void setJobNames(String jobNames)
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
setJobRegistry
@Autowired(required=false) public void setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)
setJobParametersConverter
@Autowired(required=false) public void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter converter)
setJobs
@Autowired(required=false) public void setJobs(Collection<org.springframework.batch.core.Job> jobs)
run
public void run(String... args) throws org.springframework.batch.core.JobExecutionException
- Specified by:
runin interfaceorg.springframework.boot.CommandLineRunner- Throws:
org.springframework.batch.core.JobExecutionException
launchJobFromProperties
protected void launchJobFromProperties(Properties properties) throws org.springframework.batch.core.JobExecutionException
- Throws:
org.springframework.batch.core.JobExecutionException
execute
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
- Throws:
org.springframework.batch.core.repository.JobExecutionAlreadyRunningExceptionorg.springframework.batch.core.repository.JobRestartExceptionorg.springframework.batch.core.repository.JobInstanceAlreadyCompleteExceptionorg.springframework.batch.core.JobParametersInvalidExceptionorg.springframework.batch.core.launch.JobParametersNotFoundException