Example usage for org.springframework.batch.core.configuration.support GenericApplicationContextFactory setApplicationContext

List of usage examples for org.springframework.batch.core.configuration.support GenericApplicationContextFactory setApplicationContext

Introduction

In this page you can find the example usage for org.springframework.batch.core.configuration.support GenericApplicationContextFactory setApplicationContext.

Prototype

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException 

Source Link

Document

Setter for the parent application context.

Usage

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   ww w  .  j  av  a2  s  .  com*/
    return applicationContextFactory.createApplicationContext();
}

From source file:org.springframework.batch.core.launch.support.JobRegistryBackgroundJobRunner.java

private void register(String[] paths) throws DuplicateJobException, IOException {

    maybeCreateJobLoader();/* w ww .j  a v a 2s.  c om*/

    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);
        }

    }

}