Example usage for org.springframework.batch.core.configuration.support DefaultJobLoader DefaultJobLoader

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

Introduction

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

Prototype

public DefaultJobLoader(JobRegistry jobRegistry) 

Source Link

Document

Creates a job loader with the job registry provided.

Usage

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

/**
 * If there is no {@link JobLoader} then try and create one from existing
 * bean definitions.//from w  w  w . j ava  2 s .co  m
 */
private void maybeCreateJobLoader() {

    if (jobLoader != null) {
        return;
    }

    String[] names = parentContext.getBeanNamesForType(JobLoader.class);
    if (names.length == 0) {
        if (parentContext.containsBean("jobLoader")) {
            jobLoader = parentContext.getBean("jobLoader", JobLoader.class);
            return;
        }
        if (jobRegistry != null) {
            jobLoader = new DefaultJobLoader(jobRegistry);
            return;
        }
    }

    jobLoader = parentContext.getBean(names[0], JobLoader.class);
    return;

}