Example usage for org.springframework.batch.core.explore.support JobExplorerFactoryBean setTablePrefix

List of usage examples for org.springframework.batch.core.explore.support JobExplorerFactoryBean setTablePrefix

Introduction

In this page you can find the example usage for org.springframework.batch.core.explore.support JobExplorerFactoryBean setTablePrefix.

Prototype

public void setTablePrefix(String tablePrefix) 

Source Link

Document

Sets the table prefix for all the batch meta-data tables.

Usage

From source file:de.codecentric.batch.configuration.TaskExecutorBatchConfigurer.java

@PostConstruct
public void initialize() throws Exception {
    if (dataSource == null) {
        logger.warn("No datasource was provided...using a Map based JobRepository");

        if (this.transactionManager == null) {
            this.transactionManager = new ResourcelessTransactionManager();
        }//from   www  .j  a  v  a2  s .  c o  m

        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);
        String tablePrefix = env.getProperty("batch.repository.tableprefix");
        if (tablePrefix != null) {
            jobExplorerFactoryBean.setTablePrefix(tablePrefix);
        }
        jobExplorerFactoryBean.afterPropertiesSet();
        this.jobExplorer = jobExplorerFactoryBean.getObject();
    }

    this.jobLauncher = createJobLauncher();
}

From source file:org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.java

private JobExplorer createJobExplorer() throws Exception {
    JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
    jobExplorerFactoryBean.setDataSource(this.dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        jobExplorerFactoryBean.setTablePrefix(tablePrefix);
    }/*from   w  w w  . ja  v  a  2 s. c  om*/
    jobExplorerFactoryBean.afterPropertiesSet();
    return jobExplorerFactoryBean.getObject();
}