Skip to content

Instantly share code, notes, and snippets.

@tkstone
Created April 26, 2019 02:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tkstone/5f2e5a468260f1d661704e6bad546478 to your computer and use it in GitHub Desktop.
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
public class TestRun2_2 {
public static void main(String[] args) throws Exception{
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring/job-test02-02-context.xml"});
JobLauncher jobLauncher = context.getBean(JobLauncher.class);
Job testJob = context.getBean("TestJob02", Job.class);
JobParameters jobParameters = new JobParametersBuilder()
.addString("start_time", Long.toString(System.currentTimeMillis()))
.addString("param1", "col1-1")
.toJobParameters();
jobLauncher.run(testJob, jobParameters);
//
((ClassPathXmlApplicationContext)context).close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment