Skip to content

Commit 419ebbe

Browse files
committed
Update dependencies and build for Spring 6
1 parent 3583c63 commit 419ebbe

File tree

5 files changed

+13
-22
lines changed

5 files changed

+13
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest]
11-
java: [11, 17, 21, 22-ea]
11+
java: [17, 21, 22-ea]
1212
distribution: ['temurin']
1313
fail-fast: false
1414
max-parallel: 4

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<properties>
5858
<junit.jupiter.version>5.10.1</junit.jupiter.version>
59-
<spring.batch.version>4.3.9</spring.batch.version>
59+
<spring.batch.version>5.0.3</spring.batch.version>
6060

6161
<checkstyle.config>checkstyle-override.xml</checkstyle.config>
6262

@@ -89,7 +89,7 @@
8989
<dependency>
9090
<groupId>org.springframework</groupId>
9191
<artifactId>spring-jdbc</artifactId>
92-
<version>5.3.30</version>
92+
<version>6.0.14</version>
9393
<scope>provided</scope>
9494
<optional>true</optional>
9595
</dependency>
@@ -128,7 +128,7 @@
128128
<dependency>
129129
<groupId>org.mybatis</groupId>
130130
<artifactId>mybatis-spring</artifactId>
131-
<version>2.1.1</version>
131+
<version>3.0.2</version>
132132
<scope>test</scope>
133133
</dependency>
134134
<dependency>

src/test/java/examples/springbatch/bulkinsert/BulkInsertConfiguration.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ public MyBatisBatchItemWriter<PersonRecord> writer(SqlSessionFactory sqlSessionF
103103

104104
@Bean
105105
public Step step1(ItemProcessor<PersonRecord, PersonRecord> processor, ItemWriter<PersonRecord> writer) {
106-
return new StepBuilder("step1")
107-
.repository(jobRepository) // In Spring Batch 5, move this to the step builder constructor
108-
.transactionManager(transactionManager) // In Spring Batch 5, move this to the 'chunk' method
109-
.<PersonRecord, PersonRecord>chunk(10)
106+
return new StepBuilder("step1", jobRepository)
107+
.<PersonRecord, PersonRecord>chunk(10, transactionManager)
110108
.reader(new TestRecordGenerator())
111109
.processor(processor)
112110
.writer(writer)
@@ -115,8 +113,7 @@ public Step step1(ItemProcessor<PersonRecord, PersonRecord> processor, ItemWrite
115113

116114
@Bean
117115
public Job insertRecords(Step step1) {
118-
return new JobBuilder("insertRecords")
119-
.repository(jobRepository) // In Spring Batch 5, move this to the job builder constructor
116+
return new JobBuilder("insertRecords", jobRepository)
120117
.incrementer(new RunIdIncrementer())
121118
.flow(step1)
122119
.end()

src/test/java/examples/springbatch/cursor/CursorReaderBatchConfiguration.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ public MyBatisBatchItemWriter<PersonRecord> writer(SqlSessionFactory sqlSessionF
114114

115115
@Bean
116116
public Step step1(ItemReader<PersonRecord> reader, ItemProcessor<PersonRecord, PersonRecord> processor, ItemWriter<PersonRecord> writer) {
117-
return new StepBuilder("step1")
118-
.repository(jobRepository) // In Spring Batch 5, move this to the step builder constructor
119-
.transactionManager(transactionManager) // In Spring Batch 5, move this to the 'chunk' method
120-
.<PersonRecord, PersonRecord>chunk(10)
117+
return new StepBuilder("step1", jobRepository)
118+
.<PersonRecord, PersonRecord>chunk(10, transactionManager)
121119
.reader(reader)
122120
.processor(processor)
123121
.writer(writer)
@@ -126,8 +124,7 @@ public Step step1(ItemReader<PersonRecord> reader, ItemProcessor<PersonRecord, P
126124

127125
@Bean
128126
public Job upperCaseLastName(Step step1) {
129-
return new JobBuilder("upperCaseLastName") // In Spring Batch 5, move this to the job builder constructor
130-
.repository(jobRepository)
127+
return new JobBuilder("upperCaseLastName", jobRepository) // In Spring Batch 5, move this to the job builder constructor
131128
.incrementer(new RunIdIncrementer())
132129
.flow(step1)
133130
.end()

src/test/java/examples/springbatch/paging/PagingReaderBatchConfiguration.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ public MyBatisBatchItemWriter<PersonRecord> writer(SqlSessionFactory sqlSessionF
115115

116116
@Bean
117117
public Step step1(ItemReader<PersonRecord> reader, ItemProcessor<PersonRecord, PersonRecord> processor, ItemWriter<PersonRecord> writer) {
118-
return new StepBuilder("step1")
119-
.repository(jobRepository) // In Spring Batch 5, move this to the step builder constructor
120-
.transactionManager(transactionManager) // In Spring Batch 5, move this to the 'chunk' method
121-
.<PersonRecord, PersonRecord>chunk(7)
118+
return new StepBuilder("step1", jobRepository)
119+
.<PersonRecord, PersonRecord>chunk(7, transactionManager)
122120
.reader(reader)
123121
.processor(processor)
124122
.writer(writer)
@@ -127,8 +125,7 @@ public Step step1(ItemReader<PersonRecord> reader, ItemProcessor<PersonRecord, P
127125

128126
@Bean
129127
public Job upperCaseLastName(Step step1) {
130-
return new JobBuilder("upperCaseLastName")
131-
.repository(jobRepository) // In Spring Batch 5, move this to the job builder constructor
128+
return new JobBuilder("upperCaseLastName", jobRepository)
132129
.incrementer(new RunIdIncrementer())
133130
.flow(step1)
134131
.end()

0 commit comments

Comments
 (0)