Search in sources :

Example 1 with JobRepositoryFactoryBean

use of org.springframework.batch.core.repository.support.JobRepositoryFactoryBean in project RecordManager2 by moravianlibrary.

the class AppConfig method jobRepository.

@Bean
public JobRepository jobRepository() throws Exception {
    JobRepositoryFactoryBean jobRepository = new JobRepositoryFactoryBean();
    jobRepository.setDataSource(dataSource);
    jobRepository.setTransactionManager(transactionManager());
    jobRepository.afterPropertiesSet();
    return (JobRepository) jobRepository.getObject();
}
Also used : JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean) JobRepository(org.springframework.batch.core.repository.JobRepository) JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean) JobExplorerFactoryBean(org.springframework.batch.core.explore.support.JobExplorerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with JobRepositoryFactoryBean

use of org.springframework.batch.core.repository.support.JobRepositoryFactoryBean in project tutorials by eugenp.

the class SpringConfig method getJobRepository.

private JobRepository getJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource());
    factory.setTransactionManager(getTransactionManager());
    // JobRepositoryFactoryBean's methods Throws Generic Exception,
    // it would have been better to have a specific one
    factory.afterPropertiesSet();
    return (JobRepository) factory.getObject();
}
Also used : JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean) JobRepository(org.springframework.batch.core.repository.JobRepository)

Example 3 with JobRepositoryFactoryBean

use of org.springframework.batch.core.repository.support.JobRepositoryFactoryBean in project tutorials by eugenp.

the class SpringbatchPartitionConfig method getJobRepository.

private JobRepository getJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource());
    factory.setTransactionManager(getTransactionManager());
    // JobRepositoryFactoryBean's methods Throws Generic Exception,
    // it would have been better to have a specific one
    factory.afterPropertiesSet();
    return factory.getObject();
}
Also used : JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean)

Example 4 with JobRepositoryFactoryBean

use of org.springframework.batch.core.repository.support.JobRepositoryFactoryBean in project spring-boot by spring-projects.

the class BasicBatchConfigurer method createJobRepository.

protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    PropertyMapper map = PropertyMapper.get();
    map.from(this.dataSource).to(factory::setDataSource);
    map.from(this::determineIsolationLevel).whenNonNull().to(factory::setIsolationLevelForCreate);
    map.from(this.properties.getJdbc()::getTablePrefix).whenHasText().to(factory::setTablePrefix);
    map.from(this::getTransactionManager).to(factory::setTransactionManager);
    factory.afterPropertiesSet();
    return factory.getObject();
}
Also used : JobRepositoryFactoryBean(org.springframework.batch.core.repository.support.JobRepositoryFactoryBean) PropertyMapper(org.springframework.boot.context.properties.PropertyMapper)

Aggregations

JobRepositoryFactoryBean (org.springframework.batch.core.repository.support.JobRepositoryFactoryBean)4 JobRepository (org.springframework.batch.core.repository.JobRepository)2 JobExplorerFactoryBean (org.springframework.batch.core.explore.support.JobExplorerFactoryBean)1 PropertyMapper (org.springframework.boot.context.properties.PropertyMapper)1 Bean (org.springframework.context.annotation.Bean)1