List of usage examples for org.springframework.batch.core.configuration.support ApplicationContextJobFactory ApplicationContextJobFactory
public ApplicationContextJobFactory(String jobName, ApplicationContextFactory applicationContextFactory)
From source file:test.profile.ClassPathXmlJobRegistry.java
public void afterPropertiesSet() throws Exception { for (Resource resource : jobPaths) { ClassPathXmlApplicationContextFactory applicationContextFactory = new ClassPathXmlApplicationContextFactory(); applicationContextFactory.setPath(resource); applicationContextFactory.setApplicationContext(parent); ApplicationContext context = applicationContextFactory.createApplicationContext(); String[] names = context.getBeanNamesForType(Job.class); for (String name : names) { logger.debug("Registering job: " + name + " from context: " + resource); ApplicationContextJobFactory jobFactory = new ApplicationContextJobFactory( applicationContextFactory, name); jobRegistry.register(jobFactory); }/*from w ww .j a va2 s . c om*/ } if (jobRegistry.getJobNames().isEmpty()) { throw new NoSuchJobException("Could not locate any jobs in resources provided."); } }