List of usage examples for org.springframework.batch.core.configuration.support AutomaticJobRegistrar addApplicationContextFactory
public void addApplicationContextFactory(ApplicationContextFactory applicationContextFactory)
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)); }// w w w.jav a 2 s . c o m }
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 w w.ja v a2 s. c o m*/ }