Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public class RunApp {
  2. public static void main(String[] args) {
  3.  
  4. String[] springConfig = { "hello-job.xml" };
  5.  
  6. ApplicationContext context = new ClassPathXmlApplicationContext(
  7. springConfig);
  8.  
  9. JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
  10. Job job = (Job) context.getBean("helloJob");
  11.  
  12. try {
  13.  
  14. JobExecution execution = jobLauncher.run(job, new JobParameters());
  15. System.out.println("Exit Status : " + execution.getStatus());
  16.  
  17. } catch (Exception e) {
  18. e.printStackTrace();
  19. }finally{
  20. ((AbstractApplicationContext)context).close();
  21. }
  22.  
  23. System.out.println("Done");
  24.  
  25. }
  26. }
  27.  
  28. <import resource="classpath:/config/hello-job.xml" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement