类 JobLauncherCommandLineRunner
- java.lang.Object
- org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner
- 所有已实现的接口:
org.springframework.beans.factory.Aware,org.springframework.boot.CommandLineRunner,org.springframework.context.ApplicationEventPublisherAware,org.springframework.core.Ordered
public class JobLauncherCommandLineRunner extends Object implements org.springframework.boot.CommandLineRunner, org.springframework.core.Ordered, 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
字段概要
字段 修饰符和类型 字段 说明 static intDEFAULT_ORDERThe default order for the command line runner.
构造器概要
构造器 构造器 说明 JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer)已过时。since 2.0.7 in favor ofJobLauncherCommandLineRunner(JobLauncher, JobExplorer, JobRepository).JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository)Create a newJobLauncherCommandLineRunner.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected voidexecute(org.springframework.batch.core.Job job, org.springframework.batch.core.JobParameters jobParameters)intgetOrder()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)voidsetOrder(int order)
字段详细资料
DEFAULT_ORDER
public static final int DEFAULT_ORDER
The default order for the command line runner.- 另请参阅:
- 常量字段值
构造器详细资料
JobLauncherCommandLineRunner
@Deprecated public JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer)
已过时。since 2.0.7 in favor ofJobLauncherCommandLineRunner(JobLauncher, JobExplorer, JobRepository). A job repository is required to check if a job instance exists with the given parameters when running a job (which is not possible with the job explorer).Create a newJobLauncherCommandLineRunner.- 参数:
jobLauncher- to launch jobsjobExplorer- to check the job repository for previous executions
JobLauncherCommandLineRunner
public JobLauncherCommandLineRunner(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository)
Create a newJobLauncherCommandLineRunner.- 参数:
jobLauncher- to launch jobsjobExplorer- to check the job repository for previous executionsjobRepository- to check if a job instance exists with the given parameters when running a job
方法详细资料
setOrder
public void setOrder(int order)
getOrder
public int getOrder()
- 指定者:
getOrder在接口中org.springframework.core.Ordered
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher publisher)
- 指定者:
setApplicationEventPublisher在接口中org.springframework.context.ApplicationEventPublisherAware
setJobRegistry
@Autowired(required=false) public void setJobRegistry(org.springframework.batch.core.configuration.JobRegistry jobRegistry)
setJobNames
public void setJobNames(String jobNames)
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
- 指定者:
run在接口中org.springframework.boot.CommandLineRunner- 抛出:
org.springframework.batch.core.JobExecutionException
launchJobFromProperties
protected void launchJobFromProperties(Properties properties) throws org.springframework.batch.core.JobExecutionException
- 抛出:
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
- 抛出:
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