Hello,
I have a file 'simpleJob' with the spring batch job definition which imports a file 'applicationContext.xml' like:
When I try to start the spring application context and then to retrieve the JobOperator bean, the construction of ClassPathXmlApplicationContext ends up in an endless loop (refresh) and never returns to the main method. Here is the code:Code:<import resource="classpath:/com/bc/springbatch/spike/helloworld/applicationContext.xml"/>
What is wrong?Code:public class Main { public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"simpleJob.xml"}, Main.class); //never returns from this call JobOperator jobOperator = (JobOperator) context.getBean("jobOperator"); //never reach this line Set<String> jobNames = jobOperator.getJobNames(); for (String jobName : jobNames) { System.out.println("jobName = " + jobName); } //do a lot more with jobOperator } }
Kind regards,
Kieran


Reply With Quote