Created
April 26, 2019 02:12
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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