Example usage for org.springframework.batch.core.configuration BatchConfigurationException BatchConfigurationException

List of usage examples for org.springframework.batch.core.configuration BatchConfigurationException BatchConfigurationException

Introduction

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

Prototype

public BatchConfigurationException(Throwable t) 

Source Link

Usage

From source file:org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer.java

@PostConstruct
public void initialize() {
    try {/*  w w  w.java2 s.  c  om*/
        if (dataSource == null) {
            logger.warn("No datasource was provided...using a Map based JobRepository");

            if (this.transactionManager == null) {
                this.transactionManager = new ResourcelessTransactionManager();
            }

            MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean(
                    this.transactionManager);
            jobRepositoryFactory.afterPropertiesSet();
            this.jobRepository = jobRepositoryFactory.getObject();

            MapJobExplorerFactoryBean jobExplorerFactory = new MapJobExplorerFactoryBean(jobRepositoryFactory);
            jobExplorerFactory.afterPropertiesSet();
            this.jobExplorer = jobExplorerFactory.getObject();
        } else {
            this.jobRepository = createJobRepository();

            JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
            jobExplorerFactoryBean.setDataSource(this.dataSource);
            jobExplorerFactoryBean.afterPropertiesSet();
            this.jobExplorer = jobExplorerFactoryBean.getObject();
        }

        this.jobLauncher = createJobLauncher();
    } catch (Exception e) {
        throw new BatchConfigurationException(e);
    }
}