Skip to content

Commit 6edbd71

Browse files
Copilotdependabot[bot]rashidi
authored
Bump spring-boot to version 4.0.5
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rashidi <380073+rashidi@users.noreply.github.com>
1 parent f4bb3da commit 6edbd71

File tree

93 files changed

+479
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+479
-317
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v6
22+
23+
- name: Set up JDK 25
24+
uses: actions/setup-java@v5
25+
with:
26+
java-version: "25"
27+
distribution: "temurin"
28+
29+
- name: Setup Gradle
30+
uses: gradle/actions/setup-gradle@v6

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Spring Data, Spring Batch, Spring Cloud, Spring Security, Spring GraphQL, and Sp
99
with source code in individual submodules and can be found on {url-quickref}[GitHub].
1010

1111
image:https://img.shields.io/badge/Java_-25-blue?style=flat-square[Static Badge]
12-
image:https://img.shields.io/badge/Spring_Boot-3.5.6-blue?style=flat-square&logo=springboot[Spring Boot version]
12+
image:https://img.shields.io/badge/Spring_Boot-4.0.5-blue?style=flat-square&logo=springboot[Spring Boot version]
1313
image:https://img.shields.io/github/actions/workflow/status/rashidi/spring-boot-tutorials/gradle-build.yml?style=flat-square&logo=githubactions&color=blue[Gradle Build]
1414
image:https://img.shields.io/github/actions/workflow/status/rashidi/spring-boot-tutorials/build-and-publish-antora.yml?style=flat-square&logo=antora&label=Antora&color=blue[Antora Site Status, link={url-docs}]
1515
image:https://img.shields.io/sonar/coverage/rashidi_spring-boot-tutorials?server=https%3A%2F%2Fsonarcloud.io&style=flat-square&color=blue[Sonar Coverage]
@@ -28,7 +28,7 @@ and always will be, my primary goal.
2828

2929
With the help of https://github.com/dependabot[Dependabot], each tutorial is also kept up-to-date with the latest
3030
dependencies. Currently, we are using Java https://adoptium.net/en-GB/temurin/releases?version=25[Temurin 25]
31-
with https://plugins.gradle.org/plugin/org.springframework.boot/3.5.6[Spring Boot 3.5.6].
31+
with https://plugins.gradle.org/plugin/org.springframework.boot/4.0.5[Spring Boot 4.0.5].
3232

3333
== Documentation
3434

batch-rest-repository/README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class UserBatchJobTests {
115115
private final static MongoDBContainer MONGO_DB_CONTAINER = new MongoDBContainer("mongo:latest");
116116
117117
@Autowired
118-
private JobLauncherTestUtils launcher;
118+
private JobOperatorTestUtils operator;
119119
120120
@Autowired
121121
private MongoOperations mongoOperations;
@@ -125,7 +125,7 @@ class UserBatchJobTests {
125125
void launch() {
126126
127127
await().atMost(ofSeconds(30)).untilAsserted(() -> {
128-
var execution = launcher.launchJob();
128+
var execution = operator.startJob();
129129
130130
assertThat(execution.getExitStatus()).isEqualTo(COMPLETED);
131131
});

batch-rest-repository/build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
java
3-
id("org.springframework.boot") version "3.5.7"
3+
id("org.springframework.boot") version "4.0.5"
44
id("io.spring.dependency-management") version "1.1.7"
55
}
66

@@ -20,14 +20,15 @@ repositories {
2020
dependencies {
2121
implementation("org.springframework.boot:spring-boot-starter-batch")
2222
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
23-
implementation("com.fasterxml.jackson.core:jackson-databind")
23+
implementation("tools.jackson.core:jackson-databind")
2424
runtimeOnly("com.mysql:mysql-connector-j")
2525
testImplementation("org.springframework.boot:spring-boot-starter-test")
26+
testImplementation("org.springframework.boot:spring-boot-starter-jdbc")
2627
testImplementation("org.springframework.boot:spring-boot-testcontainers")
2728
testImplementation("org.springframework.batch:spring-batch-test")
28-
testImplementation("org.testcontainers:junit-jupiter")
29-
testImplementation("org.testcontainers:mongodb")
30-
testImplementation("org.testcontainers:mysql")
29+
testImplementation("org.testcontainers:testcontainers-junit-jupiter")
30+
testImplementation("org.testcontainers:testcontainers-mongodb")
31+
testImplementation("org.testcontainers:testcontainers-mysql")
3132
}
3233

3334
tasks.named<Test>("test") {

batch-rest-repository/src/main/java/zin/rashidi/boot/batch/rest/user/UserJobConfiguration.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11
package zin.rashidi.boot.batch.rest.user;
22

33
import java.net.MalformedURLException;
4-
5-
import org.springframework.batch.core.Job;
6-
import org.springframework.batch.core.Step;
4+
import tools.jackson.databind.DeserializationFeature;
5+
import tools.jackson.databind.json.JsonMapper;
6+
import org.springframework.batch.core.job.Job;
77
import org.springframework.batch.core.job.builder.JobBuilder;
88
import org.springframework.batch.core.repository.JobRepository;
9+
import org.springframework.batch.core.step.Step;
910
import org.springframework.batch.core.step.builder.StepBuilder;
10-
import org.springframework.batch.item.data.MongoItemWriter;
11-
import org.springframework.batch.item.data.builder.MongoItemWriterBuilder;
12-
import org.springframework.batch.item.json.JacksonJsonObjectReader;
13-
import org.springframework.batch.item.json.JsonItemReader;
14-
import org.springframework.batch.item.json.builder.JsonItemReaderBuilder;
11+
import org.springframework.batch.infrastructure.item.data.MongoItemWriter;
12+
import org.springframework.batch.infrastructure.item.data.builder.MongoItemWriterBuilder;
13+
import org.springframework.batch.infrastructure.item.json.JacksonJsonObjectReader;
14+
import org.springframework.batch.infrastructure.item.json.JsonItemReader;
15+
import org.springframework.batch.infrastructure.item.json.builder.JsonItemReaderBuilder;
16+
import org.springframework.beans.factory.annotation.Value;
1517
import org.springframework.context.annotation.Bean;
1618
import org.springframework.context.annotation.Configuration;
17-
import org.springframework.core.io.UrlResource;
19+
import org.springframework.core.io.Resource;
1820
import org.springframework.data.mongodb.core.MongoOperations;
1921
import org.springframework.transaction.PlatformTransactionManager;
2022

21-
import com.fasterxml.jackson.databind.ObjectMapper;
22-
2323
/**
2424
* @author Rashidi Zin
2525
*/
2626
@Configuration
2727
class UserJobConfiguration {
2828

29-
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
29+
private static final JsonMapper OBJECT_MAPPER = JsonMapper.builder()
30+
.disable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
31+
.build();
3032

3133
private final JobRepository jobRepository;
3234
private final PlatformTransactionManager transactionManager;
3335
private final MongoOperations mongo;
36+
private final Resource usersResource;
3437

35-
UserJobConfiguration(JobRepository jobRepository, PlatformTransactionManager transactionManager, MongoOperations mongo) {
38+
UserJobConfiguration(JobRepository jobRepository, PlatformTransactionManager transactionManager, MongoOperations mongo,
39+
@Value("${batch.users.resource:https://jsonplaceholder.typicode.com/users}") Resource usersResource) {
3640
this.jobRepository = jobRepository;
3741
this.transactionManager = transactionManager;
3842
this.mongo = mongo;
43+
this.usersResource = usersResource;
3944
}
4045

4146
@Bean
@@ -45,21 +50,22 @@ public Job userJob() throws MalformedURLException {
4550

4651
private Step step() throws MalformedURLException {
4752
return new StepBuilder("userStep", jobRepository)
48-
.<User, User>chunk(10, transactionManager)
53+
.<User, User>chunk(10)
54+
.transactionManager(transactionManager)
4955
.reader(reader())
5056
.writer(writer())
5157
.build();
5258
}
5359

54-
private JsonItemReader<User> reader() throws MalformedURLException {
60+
private JsonItemReader<User> reader() {
5561
JacksonJsonObjectReader<User> jsonObjectReader = new JacksonJsonObjectReader<>(User.class);
5662

5763
jsonObjectReader.setMapper(OBJECT_MAPPER);
5864

5965
return new JsonItemReaderBuilder<User>()
6066
.name("userReader")
6167
.jsonObjectReader(jsonObjectReader)
62-
.resource(new UrlResource("https://jsonplaceholder.typicode.com/users"))
68+
.resource(usersResource)
6369
.build();
6470
}
6571

batch-rest-repository/src/test/java/zin/rashidi/boot/batch/rest/user/UserBatchJobTests.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import com.mongodb.MongoClientSettings;
55
import org.junit.jupiter.api.DisplayName;
66
import org.junit.jupiter.api.Test;
7-
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
8-
import org.springframework.batch.test.JobLauncherTestUtils;
7+
import org.springframework.batch.core.configuration.support.JdbcDefaultBatchConfiguration;
8+
import org.springframework.batch.core.job.JobExecution;
9+
import org.springframework.batch.test.JobOperatorTestUtils;
910
import org.springframework.batch.test.context.SpringBatchTest;
1011
import org.springframework.beans.factory.annotation.Autowired;
1112
import org.springframework.boot.jdbc.DataSourceBuilder;
@@ -17,18 +18,18 @@
1718
import org.springframework.data.mongodb.core.MongoOperations;
1819
import org.springframework.jdbc.support.JdbcTransactionManager;
1920
import org.springframework.transaction.PlatformTransactionManager;
20-
import org.testcontainers.containers.MongoDBContainer;
21-
import org.testcontainers.containers.MySQLContainer;
2221
import org.testcontainers.junit.jupiter.Container;
2322
import org.testcontainers.junit.jupiter.Testcontainers;
23+
import org.testcontainers.mongodb.MongoDBContainer;
24+
import org.testcontainers.mysql.MySQLContainer;
2425

2526
import javax.sql.DataSource;
2627

2728
import static java.time.Duration.ofSeconds;
2829
import static org.assertj.core.api.Assertions.assertThat;
2930
import static org.springframework.batch.core.ExitStatus.COMPLETED;
3031
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
31-
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
32+
import static org.awaitility.Awaitility.await;
3233
import static zin.rashidi.boot.batch.rest.user.UserBatchJobTests.BatchTestConfiguration;
3334
import static zin.rashidi.boot.batch.rest.user.UserBatchJobTests.MongoTestConfiguration;
3435

@@ -37,20 +38,21 @@
3738
*/
3839
@Testcontainers
3940
@SpringBatchTest
40-
@SpringBootTest(classes = { BatchTestConfiguration.class, MongoTestConfiguration.class, UserJobConfiguration.class }, webEnvironment = NONE)
41+
@SpringBootTest(classes = { BatchTestConfiguration.class, MongoTestConfiguration.class, UserJobConfiguration.class }, webEnvironment = NONE,
42+
properties = "batch.users.resource=classpath:users.json")
4143
class UserBatchJobTests {
4244

4345
@Container
4446
@ServiceConnection
45-
private final static MySQLContainer<?> MYSQL_CONTAINER = new MySQLContainer<>("mysql:lts")
47+
private final static MySQLContainer MYSQL_CONTAINER = new MySQLContainer("mysql:lts")
4648
.withInitScript("org/springframework/batch/core/schema-mysql.sql");
4749

4850
@Container
4951
@ServiceConnection
5052
private final static MongoDBContainer MONGO_DB_CONTAINER = new MongoDBContainer("mongo:latest");
5153

5254
@Autowired
53-
private JobLauncherTestUtils launcher;
55+
private JobOperatorTestUtils operator;
5456

5557
@Autowired
5658
private MongoOperations mongoOperations;
@@ -60,7 +62,7 @@ class UserBatchJobTests {
6062
void launch() {
6163

6264
await().atMost(ofSeconds(30)).untilAsserted(() -> {
63-
var execution = launcher.launchJob();
65+
var execution = operator.startJob();
6466

6567
assertThat(execution.getExitStatus()).isEqualTo(COMPLETED);
6668
});
@@ -71,7 +73,7 @@ void launch() {
7173
}
7274

7375
@TestConfiguration
74-
static class BatchTestConfiguration extends DefaultBatchConfiguration {
76+
static class BatchTestConfiguration extends JdbcDefaultBatchConfiguration {
7577

7678
@Override
7779
protected DataSource getDataSource() {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{"id": 1, "username": "Bret"},
3+
{"id": 2, "username": "Antonette"},
4+
{"id": 3, "username": "Samantha"},
5+
{"id": 4, "username": "Karianne"},
6+
{"id": 5, "username": "Kamren"},
7+
{"id": 6, "username": "Leopoldo_Corkery"},
8+
{"id": 7, "username": "Elwyn.Skiles"},
9+
{"id": 8, "username": "Maxime_Nienow"},
10+
{"id": 9, "username": "Delphine"},
11+
{"id": 10, "username": "Moriah.Stiedemann"}
12+
]

batch-skip-step/README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class UserBatchJobTests {
125125
private final static MySQLContainer<?> MYSQL_CONTAINER = new MySQLContainer<>("mysql:lts");
126126
127127
@Autowired
128-
private JobLauncherTestUtils launcher;
128+
private JobOperatorTestUtils operator;
129129
130130
@Autowired
131131
private JdbcTemplate jdbc;
@@ -135,7 +135,7 @@ class UserBatchJobTests {
135135
void findAll() {
136136
137137
await().atMost(10, SECONDS).untilAsserted(() -> {
138-
var execution = launcher.launchJob();
138+
var execution = operator.startJob();
139139
assertThat(execution.getExitStatus()).isEqualTo(COMPLETED);
140140
});
141141

batch-skip-step/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
java
3-
id("org.springframework.boot") version "3.5.7"
3+
id("org.springframework.boot") version "4.0.5"
44
id("io.spring.dependency-management") version "1.1.7"
55
}
66

@@ -20,13 +20,13 @@ repositories {
2020
dependencies {
2121
implementation("org.springframework.boot:spring-boot-starter-batch")
2222
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
23-
implementation("com.fasterxml.jackson.core:jackson-databind")
23+
implementation("tools.jackson.core:jackson-databind")
2424
runtimeOnly("com.mysql:mysql-connector-j")
2525
testImplementation("org.springframework.boot:spring-boot-starter-test")
2626
testImplementation("org.springframework.boot:spring-boot-testcontainers")
2727
testImplementation("org.springframework.batch:spring-batch-test")
28-
testImplementation("org.testcontainers:junit-jupiter")
29-
testImplementation("org.testcontainers:mysql")
28+
testImplementation("org.testcontainers:testcontainers-junit-jupiter")
29+
testImplementation("org.testcontainers:testcontainers-mysql")
3030
}
3131

3232
tasks.named<Test>("test") {

batch-skip-step/src/main/java/zin/rashidi/boot/batch/user/UserJobConfiguration.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package zin.rashidi.boot.batch.user;
22

3-
import com.fasterxml.jackson.databind.ObjectMapper;
4-
import org.springframework.batch.core.Job;
5-
import org.springframework.batch.core.Step;
3+
import tools.jackson.databind.DeserializationFeature;
4+
import tools.jackson.databind.json.JsonMapper;
5+
import org.springframework.batch.core.job.Job;
66
import org.springframework.batch.core.job.builder.JobBuilder;
77
import org.springframework.batch.core.repository.JobRepository;
8+
import org.springframework.batch.core.step.Step;
89
import org.springframework.batch.core.step.builder.StepBuilder;
9-
import org.springframework.batch.item.ItemProcessor;
10-
import org.springframework.batch.item.database.JdbcBatchItemWriter;
11-
import org.springframework.batch.item.database.builder.JdbcBatchItemWriterBuilder;
12-
import org.springframework.batch.item.json.JacksonJsonObjectReader;
13-
import org.springframework.batch.item.json.JsonItemReader;
14-
import org.springframework.batch.item.json.builder.JsonItemReaderBuilder;
10+
import org.springframework.batch.infrastructure.item.ItemProcessor;
11+
import org.springframework.batch.infrastructure.item.database.JdbcBatchItemWriter;
12+
import org.springframework.batch.infrastructure.item.database.builder.JdbcBatchItemWriterBuilder;
13+
import org.springframework.batch.infrastructure.item.json.JacksonJsonObjectReader;
14+
import org.springframework.batch.infrastructure.item.json.JsonItemReader;
15+
import org.springframework.batch.infrastructure.item.json.builder.JsonItemReaderBuilder;
1516
import org.springframework.context.annotation.Bean;
1617
import org.springframework.context.annotation.Configuration;
1718
import org.springframework.core.io.ClassPathResource;
@@ -25,7 +26,9 @@
2526
@Configuration
2627
class UserJobConfiguration {
2728

28-
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
29+
private static final JsonMapper OBJECT_MAPPER = JsonMapper.builder()
30+
.disable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
31+
.build();
2932

3033
private JsonItemReader<UserFile> reader() {
3134
JacksonJsonObjectReader<UserFile> reader = new JacksonJsonObjectReader<>(UserFile.class);
@@ -61,7 +64,8 @@ private JdbcBatchItemWriter<User> writer(DataSource dataSource) {
6164

6265
private Step step(JobRepository jobRepository, PlatformTransactionManager transactionManager, DataSource dataSource) {
6366
return new StepBuilder("userStep", jobRepository)
64-
.<UserFile, User>chunk(10, transactionManager)
67+
.<UserFile, User>chunk(10)
68+
.transactionManager(transactionManager)
6569
.reader(reader())
6670
.processor(processor())
6771
.writer(writer(dataSource))

0 commit comments

Comments
 (0)