Skip to content

Commit 1141975

Browse files
committed
Add isolationLevelForCreate attribute in EnableBatchProcessing
Related to #3942
1 parent e33659c commit 1141975

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/BatchRegistrar.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ private void registerJobRepository(BeanDefinitionRegistry registry, EnableBatchP
117117
beanDefinitionBuilder.addPropertyValue("tablePrefix", tablePrefix);
118118
}
119119

120+
String isolationLevelForCreate = batchAnnotation.isolationLevelForCreate();
121+
if (isolationLevelForCreate != null) {
122+
beanDefinitionBuilder.addPropertyValue("isolationLevelForCreate", isolationLevelForCreate);
123+
}
124+
120125
beanDefinitionBuilder.addPropertyValue("maxVarCharLength", batchAnnotation.maxVarCharLength());
121126
beanDefinitionBuilder.addPropertyValue("clobType", batchAnnotation.clobType());
122127
registry.registerBeanDefinition("jobRepository", beanDefinitionBuilder.getBeanDefinition());

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
* @Import(DataSourceConfiguration.class)
4848
* public class AppConfig {
4949
*
50-
* @Autowired
51-
* private JobRepository jobRepository;
52-
*
5350
* @Bean
5451
* public Job job(JobRepository jobRepository) {
5552
* return new JobBuilder("myJob").repository(jobRepository).start(step1()).next(step2()).build();
@@ -75,7 +72,7 @@
7572
* Note that only one of your configuration classes needs to have the
7673
* <code>&#064;EnableBatchProcessing</code> annotation. Once you have an
7774
* <code>&#064;EnableBatchProcessing</code> class in your configuration, you have an
78-
* instance of {@link StepScope} and
75+
* instance of {@link org.springframework.batch.core.scope.StepScope} and
7976
* {@link org.springframework.batch.core.scope.JobScope}, so your beans inside steps can
8077
* have <code>&#064;Scope("step")</code> and <code>&#064;Scope("job")</code> respectively.
8178
* You can also use <code>&#064;Autowired</code> to insert some useful beans into your
@@ -224,6 +221,13 @@
224221
*/
225222
int clobType() default Types.CLOB;
226223

224+
/**
225+
* Set the isolation level for create parameter value. Defaults to
226+
* {@literal ISOLATION_SERIALIZABLE}.
227+
* @return the value of the isolation level for create parameter
228+
*/
229+
String isolationLevelForCreate() default "ISOLATION_SERIALIZABLE";
230+
227231
/**
228232
* Set the task executor to use in the job launcher.
229233
* @return the bean name of the task executor to use. Defaults to

0 commit comments

Comments
 (0)