org.springframework.batch.core.configuration.annotation.BatchConfigurer Java Examples

The following examples show how to use org.springframework.batch.core.configuration.annotation.BatchConfigurer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BatchConfiguration.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Bean
BatchConfigurer myBatchConfigurer(DataSource dataSource,
		Jackson2ExecutionContextStringSerializer myJackson2ExecutionContextStringSerializer,
		PlatformTransactionManager transactionManager) {
	return new DefaultBatchConfigurer(dataSource) {
		@Override
		protected JobExplorer createJobExplorer() throws Exception {
			JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
			jobExplorerFactoryBean.setDataSource(dataSource);
			jobExplorerFactoryBean
					.setSerializer(myJackson2ExecutionContextStringSerializer);
			jobExplorerFactoryBean.afterPropertiesSet();
			return jobExplorerFactoryBean.getObject();
		}

		@Override
		protected JobRepository createJobRepository() throws Exception {
			JobRepositoryFactoryBean jobRepositoryFactoryBean = new JobRepositoryFactoryBean();
			jobRepositoryFactoryBean.setDataSource(dataSource);
			jobRepositoryFactoryBean
					.setSerializer(myJackson2ExecutionContextStringSerializer);
			jobRepositoryFactoryBean.setTransactionManager(transactionManager);
			jobRepositoryFactoryBean.afterPropertiesSet();
			return jobRepositoryFactoryBean.getObject();
		}
	};
}
 
Example #2
Source File: ComposedTaskRunnerConfiguration.java    From composed-task-runner with Apache License 2.0 4 votes vote down vote up
@Bean
public BatchConfigurer getComposedBatchConfigurer(BatchProperties properties, DataSource dataSource, TransactionManagerCustomizers transactionManagerCustomizers) {
	return new ComposedBatchConfigurer(properties, dataSource, transactionManagerCustomizers);
}
 
Example #3
Source File: ComposedTaskRunnerConfiguration.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
@Bean
public BatchConfigurer getComposedBatchConfigurer(BatchProperties properties, DataSource dataSource, TransactionManagerCustomizers transactionManagerCustomizers) {
	return new org.springframework.cloud.dataflow.composedtaskrunner.ComposedBatchConfigurer(properties, dataSource, transactionManagerCustomizers);
}
 
Example #4
Source File: SpringBatchLightminBatchConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(value = {JobRepository.class})
public JobRepository jobRepository(final BatchConfigurer batchConfigurer) throws Exception {
    return batchConfigurer.getJobRepository();
}
 
Example #5
Source File: SpringBatchLightminBatchConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Primary
@Bean(name = "jobLauncher")
public JobLauncher jobLauncher(final BatchConfigurer batchConfigurer) throws Exception {
    return batchConfigurer.getJobLauncher();
}
 
Example #6
Source File: SpringBatchLightminBatchConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(value = {JobLauncher.class})
public JobExplorer jobExplorer(final BatchConfigurer batchConfigurer) throws Exception {
    return batchConfigurer.getJobExplorer();
}
 
Example #7
Source File: SpringBatchLightminBatchConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(value = {StepBuilderFactory.class})
public StepBuilderFactory stepBuilderFactory(final BatchConfigurer batchConfigurer) throws Exception {
    return new StepBuilderFactory(batchConfigurer.getJobRepository(), batchConfigurer.getTransactionManager());
}
 
Example #8
Source File: TaskJobLauncherCommandLineRunnerTests.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Bean
public BatchConfigurer batchConfigurer(DataSource dataSource) {
	return new TestBatchConfigurer(dataSource);
}