List of usage examples for org.springframework.batch.core.configuration.support GenericApplicationContextFactory GenericApplicationContextFactory
public GenericApplicationContextFactory(Object... resources)
From source file:de.codecentric.batch.configuration.AutomaticJobRegistrarConfiguration.java
protected void registerJobsFromXml(AutomaticJobRegistrar automaticJobRegistrar) throws IOException { // Add all XML-Configurations to the AutomaticJobRegistrar ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); Resource[] xmlConfigurations = resourcePatternResolver.getResources( "classpath*:" + env.getProperty("batch.config.path.xml", "/META-INF/spring/batch/jobs") + "/*.xml"); for (Resource resource : xmlConfigurations) { LOGGER.info("Register jobs from {}", resource); automaticJobRegistrar.addApplicationContextFactory(new GenericApplicationContextFactory(resource)); }/*from w ww . ja v a 2s . com*/ }
From source file:de.codecentric.batch.configuration.AutomaticJobRegistrarConfiguration.java
protected void registerJobsFromJavaConfig(AutomaticJobRegistrar automaticJobRegistrar) throws ClassNotFoundException, IOException { List<Class<?>> classes = findMyTypes( env.getProperty("batch.config.package.javaconfig", "spring.batch.jobs")); for (Class<?> clazz : classes) { LOGGER.info("Register jobs from {}", clazz); automaticJobRegistrar.addApplicationContextFactory(new GenericApplicationContextFactory(clazz)); }/* www. ja v a 2s. com*/ }
From source file:com.iisigroup.cap.batch.handler.BatchHandler.java
protected ApplicationContext createApplicationContextFactory(ApplicationContext parent, org.springframework.core.io.Resource resource) { GenericApplicationContextFactory applicationContextFactory = new GenericApplicationContextFactory(resource); if (parent != null) { applicationContextFactory.setApplicationContext(parent); }//from w w w . jav a 2s . com return applicationContextFactory.createApplicationContext(); }
From source file:org.springframework.batch.core.launch.support.JobRegistryBackgroundJobRunner.java
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader();/*www. j a v a2 s .co m*/ for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); GenericApplicationContextFactory factory = new GenericApplicationContextFactory(path); factory.setApplicationContext(parentContext); jobLoader.load(factory); } } }