Move the transaction manager configuration to AbstractTaskletStepBuilder

Before this commit, the transaction manager was configurable
at the StepBuilder level, which is inconsistent with the XML
config style in addition to be not needed for most step types.

This commit moves the configuration of the transaction manager
from the StepBuilder down to the AbstractTaskletStepBuilder,
which is the level where the transaction manager is needed.

Resolves #4130
This commit is contained in:
Mahmoud Ben Hassine
2022-09-02 10:35:02 +02:00
parent 55af86df59
commit 7c8fb172a7
46 changed files with 409 additions and 195 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2021 the original author or authors.
* Copyright 2018-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,9 +85,9 @@ public class BatchIntegrationConfiguration implements InitializingBean {
this.transactionManager);
this.remoteChunkingWorkerBuilder = new RemoteChunkingWorkerBuilder<>();
this.remotePartitioningManagerStepBuilderFactory = new RemotePartitioningManagerStepBuilderFactory(
this.jobRepository, this.jobExplorer, this.transactionManager);
this.jobRepository, this.jobExplorer);
this.remotePartitioningWorkerStepBuilderFactory = new RemotePartitioningWorkerStepBuilderFactory(
this.jobRepository, this.jobExplorer, this.transactionManager);
this.jobRepository, this.jobExplorer);
}
}

View File

@@ -234,12 +234,6 @@ public class RemotePartitioningManagerStepBuilder extends PartitionStepBuilder {
return this;
}
@Override
public RemotePartitioningManagerStepBuilder transactionManager(PlatformTransactionManager transactionManager) {
super.transactionManager(transactionManager);
return this;
}
@Override
public RemotePartitioningManagerStepBuilder partitioner(String workerStepName, Partitioner partitioner) {
super.partitioner(workerStepName, partitioner);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,20 +39,15 @@ public class RemotePartitioningManagerStepBuilderFactory implements BeanFactoryA
final private JobRepository jobRepository;
final private PlatformTransactionManager transactionManager;
/**
* Create a new {@link RemotePartitioningManagerStepBuilderFactory}.
* @param jobRepository the job repository to use
* @param jobExplorer the job explorer to use
* @param transactionManager the transaction manager to use
*/
public RemotePartitioningManagerStepBuilderFactory(JobRepository jobRepository, JobExplorer jobExplorer,
PlatformTransactionManager transactionManager) {
public RemotePartitioningManagerStepBuilderFactory(JobRepository jobRepository, JobExplorer jobExplorer) {
this.jobRepository = jobRepository;
this.jobExplorer = jobExplorer;
this.transactionManager = transactionManager;
}
@Override
@@ -68,8 +63,7 @@ public class RemotePartitioningManagerStepBuilderFactory implements BeanFactoryA
*/
public RemotePartitioningManagerStepBuilder get(String name) {
return new RemotePartitioningManagerStepBuilder(name).repository(this.jobRepository)
.jobExplorer(this.jobExplorer).beanFactory(this.beanFactory)
.transactionManager(this.transactionManager);
.jobExplorer(this.jobExplorer).beanFactory(this.beanFactory);
}
}

View File

@@ -150,12 +150,6 @@ public class RemotePartitioningWorkerStepBuilder extends StepBuilder {
return this;
}
@Override
public RemotePartitioningWorkerStepBuilder transactionManager(PlatformTransactionManager transactionManager) {
super.transactionManager(transactionManager);
return this;
}
@Override
public RemotePartitioningWorkerStepBuilder startLimit(int startLimit) {
super.startLimit(startLimit);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,20 +39,15 @@ public class RemotePartitioningWorkerStepBuilderFactory implements BeanFactoryAw
final private JobRepository jobRepository;
final private PlatformTransactionManager transactionManager;
/**
* Create a new {@link RemotePartitioningWorkerStepBuilderFactory}.
* @param jobRepository the job repository to use
* @param jobExplorer the job explorer to use
* @param transactionManager the transaction manager to use
*/
public RemotePartitioningWorkerStepBuilderFactory(JobRepository jobRepository, JobExplorer jobExplorer,
PlatformTransactionManager transactionManager) {
public RemotePartitioningWorkerStepBuilderFactory(JobRepository jobRepository, JobExplorer jobExplorer) {
this.jobExplorer = jobExplorer;
this.jobRepository = jobRepository;
this.transactionManager = transactionManager;
}
@Override
@@ -68,8 +63,7 @@ public class RemotePartitioningWorkerStepBuilderFactory implements BeanFactoryAw
*/
public RemotePartitioningWorkerStepBuilder get(String name) {
return new RemotePartitioningWorkerStepBuilder(name).repository(this.jobRepository)
.jobExplorer(this.jobExplorer).beanFactory(this.beanFactory)
.transactionManager(this.transactionManager);
.jobExplorer(this.jobExplorer).beanFactory(this.beanFactory);
}
}