Skip to content

Commit 4c6301d

Browse files
committed
Update Spring Boot to version 4.0.0-RC2
1 parent d3dd193 commit 4c6301d

File tree

8 files changed

+24
-23
lines changed

8 files changed

+24
-23
lines changed

complete/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.springframework.boot' version '3.5.3'
2+
id 'org.springframework.boot' version '4.0.0-RC2'
33
id 'java'
44
}
55

complete/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.5.3</version>
8+
<version>4.0.0-RC2</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.example</groupId>
@@ -19,7 +19,7 @@
1919
<dependencies>
2020
<dependency>
2121
<groupId>org.springframework.boot</groupId>
22-
<artifactId>spring-boot-starter-batch</artifactId>
22+
<artifactId>spring-boot-starter-batch-jdbc</artifactId>
2323
</dependency>
2424

2525
<dependency>

complete/src/main/java/com/example/batchprocessing/BatchConfiguration.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import javax.sql.DataSource;
44

5-
import org.springframework.batch.core.Job;
6-
import org.springframework.batch.core.Step;
5+
import org.springframework.batch.core.job.Job;
6+
import org.springframework.batch.core.step.Step;
77
import org.springframework.batch.core.job.builder.JobBuilder;
88
import org.springframework.batch.core.repository.JobRepository;
99
import org.springframework.batch.core.step.builder.StepBuilder;
10-
import org.springframework.batch.item.database.JdbcBatchItemWriter;
11-
import org.springframework.batch.item.database.builder.JdbcBatchItemWriterBuilder;
12-
import org.springframework.batch.item.file.FlatFileItemReader;
13-
import org.springframework.batch.item.file.builder.FlatFileItemReaderBuilder;
10+
import org.springframework.batch.infrastructure.item.database.JdbcBatchItemWriter;
11+
import org.springframework.batch.infrastructure.item.database.builder.JdbcBatchItemWriterBuilder;
12+
import org.springframework.batch.infrastructure.item.file.FlatFileItemReader;
13+
import org.springframework.batch.infrastructure.item.file.builder.FlatFileItemReaderBuilder;
1414
import org.springframework.context.annotation.Bean;
1515
import org.springframework.context.annotation.Configuration;
1616
import org.springframework.core.io.ClassPathResource;
@@ -49,7 +49,7 @@ public JdbcBatchItemWriter<Person> writer(DataSource dataSource) {
4949
// tag::jobstep[]
5050
@Bean
5151
public Job importUserJob(JobRepository jobRepository, Step step1, JobCompletionNotificationListener listener) {
52-
return new JobBuilder("importUserJob", jobRepository)
52+
return new JobBuilder(jobRepository)
5353
.listener(listener)
5454
.start(step1)
5555
.build();
@@ -58,8 +58,9 @@ public Job importUserJob(JobRepository jobRepository, Step step1, JobCompletionN
5858
@Bean
5959
public Step step1(JobRepository jobRepository, DataSourceTransactionManager transactionManager,
6060
FlatFileItemReader<Person> reader, PersonItemProcessor processor, JdbcBatchItemWriter<Person> writer) {
61-
return new StepBuilder("step1", jobRepository)
62-
.<Person, Person>chunk(3, transactionManager)
61+
return new StepBuilder(jobRepository)
62+
.<Person, Person>chunk(3)
63+
.transactionManager(transactionManager)
6364
.reader(reader)
6465
.processor(processor)
6566
.writer(writer)

complete/src/main/java/com/example/batchprocessing/JobCompletionNotificationListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import org.slf4j.LoggerFactory;
55

66
import org.springframework.batch.core.BatchStatus;
7-
import org.springframework.batch.core.JobExecution;
8-
import org.springframework.batch.core.JobExecutionListener;
7+
import org.springframework.batch.core.job.JobExecution;
8+
import org.springframework.batch.core.listener.JobExecutionListener;
99
import org.springframework.jdbc.core.DataClassRowMapper;
1010
import org.springframework.jdbc.core.JdbcTemplate;
1111
import org.springframework.stereotype.Component;

complete/src/main/java/com/example/batchprocessing/PersonItemProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
55

6-
import org.springframework.batch.item.ItemProcessor;
6+
import org.springframework.batch.infrastructure.item.ItemProcessor;
77

88
public class PersonItemProcessor implements ItemProcessor<Person, Person> {
99

complete/src/test/java/com/example/batchprocessing/BatchConfigurationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import org.junit.jupiter.api.BeforeEach;
66
import org.junit.jupiter.api.Test;
77
import org.springframework.batch.core.ExitStatus;
8-
import org.springframework.batch.core.Job;
9-
import org.springframework.batch.core.JobExecution;
10-
import org.springframework.batch.test.JobLauncherTestUtils;
8+
import org.springframework.batch.core.job.Job;
9+
import org.springframework.batch.core.job.JobExecution;
10+
import org.springframework.batch.test.JobOperatorTestUtils;
1111
import org.springframework.batch.test.JobRepositoryTestUtils;
1212
import org.springframework.batch.test.context.SpringBatchTest;
1313
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,15 +28,15 @@
2828
class BatchConfigurationTest {
2929

3030
@Autowired
31-
private JobLauncherTestUtils jobLauncherTestUtils;
31+
private JobOperatorTestUtils jobOperatorTestUtils;
3232
@Autowired
3333
private JobRepositoryTestUtils jobRepositoryTestUtils;
3434
@Autowired
3535
private Job importUserJob;
3636

3737
@BeforeEach
3838
void setUp() {
39-
jobLauncherTestUtils.setJob(importUserJob);
39+
jobOperatorTestUtils.setJob(importUserJob);
4040
}
4141

4242
@AfterEach
@@ -46,7 +46,7 @@ void tearDown() {
4646

4747
@Test
4848
void importUserJob_WhenJobEnds_ThenStatusCompleted() throws Exception {
49-
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
49+
JobExecution jobExecution = jobOperatorTestUtils.startJob();
5050
Assertions.assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
5151
}
5252
}

initial/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.springframework.boot' version '3.5.3'
2+
id 'org.springframework.boot' version '4.0.0-RC2'
33
id 'java'
44
}
55

initial/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.5.3</version>
8+
<version>4.0.0-RC2</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.example</groupId>

0 commit comments

Comments
 (0)