Skip to content

Commit 29f3278

Browse files
committed
Upgrade to Spring Boot 4.0
Signed-off-by: Sébastien Deleuze <sdeleuze@users.noreply.github.com>
1 parent a9199e5 commit 29f3278

File tree

15 files changed

+68
-36
lines changed

15 files changed

+68
-36
lines changed

README.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/
1919
[[scratch]]
2020
== Starting with Spring Initializr
2121

22-
You can use this https://start.spring.io/#!type=maven-project&platformVersion=3.5.5&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=accessing-data-jpa&name=accessing-data-jpa&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.accessingdatajpa&dependencies=data-jpa,h2[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial.
22+
You can use this https://start.spring.io/#!type=gradle-project&language=java&jvmVersion=17&packaging=jar&groupId=com.example&artifactId=accessing-data-jpa&packageName=com.example.accessingdatajpa&dependencies=data-jpa,h2[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial.
2323

2424
To manually initialize the project:
2525

2626
. Navigate to https://start.spring.io.
2727
This service pulls in all the dependencies you need for an application and does most of the setup for you.
2828
. Choose either Gradle or Maven and the language you want to use.
29+
. Type "accessing-data-jpa" in the "Artifact" form field.
2930
. Click *Dependencies* and select *Spring Data JPA* and then *H2 Database*.
3031
. Click *Generate*.
3132
. Download the resulting ZIP file, which is an archive of a web application that is configured with your choices.

complete-kotlin/build.gradle.kts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
plugins {
2-
id("org.springframework.boot") version "3.5.7"
2+
id("org.springframework.boot") version "4.0.0"
33
id("io.spring.dependency-management") version "1.1.7"
4-
kotlin("jvm") version "1.9.25"
5-
kotlin("plugin.spring") version "1.9.25"
6-
kotlin("plugin.jpa") version "1.9.25"
4+
kotlin("jvm") version "2.2.21"
5+
kotlin("plugin.spring") version "2.2.21"
6+
kotlin("plugin.jpa") version "2.2.21"
77
}
88

99
group = "com.example"
1010
version = "0.0.1-SNAPSHOT"
11-
java.sourceCompatibility = JavaVersion.VERSION_17
11+
12+
java {
13+
toolchain {
14+
languageVersion = JavaLanguageVersion.of(17)
15+
}
16+
}
1217

1318
repositories {
1419
mavenCentral()
@@ -19,12 +24,12 @@ dependencies {
1924
implementation("org.jetbrains.kotlin:kotlin-reflect")
2025
runtimeOnly("com.h2database:h2")
2126
testImplementation("org.springframework.boot:spring-boot-starter-test")
27+
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
2228
}
2329

2430
kotlin {
25-
jvmToolchain(17)
2631
compilerOptions {
27-
freeCompilerArgs.addAll("-Xjsr305=strict")
32+
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
2833
}
2934
}
3035

complete-kotlin/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "accessing-data-jpa"
1+
rootProject.name = "accessing-data-jpa-complete"

complete-kotlin/src/test/kotlin/com/example/accessingdatajpa/CustomerRepositoryTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package com.example.accessingdatajpa
1818
import org.assertj.core.api.Assertions.assertThat
1919
import org.junit.jupiter.api.Test
2020
import org.springframework.beans.factory.annotation.Autowired
21-
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
22-
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager
21+
import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest
22+
import org.springframework.boot.jpa.test.autoconfigure.TestEntityManager
2323

2424
@DataJpaTest
2525
class CustomerRepositoryTests @Autowired constructor(

complete/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
plugins {
2-
id 'org.springframework.boot' version '3.5.7'
2+
id 'org.springframework.boot' version '4.0.0'
33
id 'io.spring.dependency-management' version '1.1.7'
44
id 'java'
55
}
66

77
group = 'com.example'
88
version = '0.0.1-SNAPSHOT'
9-
sourceCompatibility = '17'
9+
10+
java {
11+
toolchain {
12+
languageVersion = JavaLanguageVersion.of(17)
13+
}
14+
}
1015

1116
repositories {
1217
mavenCentral()
@@ -16,6 +21,7 @@ dependencies {
1621
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
1722
runtimeOnly 'com.h2database:h2'
1823
testImplementation 'org.springframework.boot:spring-boot-starter-test'
24+
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
1925
}
2026

2127
test {

complete/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

complete/pom.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.5.7</version>
8+
<version>4.0.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.example</groupId>
12-
<artifactId>demo</artifactId>
12+
<artifactId>accessing-data-jpa-complete</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<name>accessing-data-jpa-complete</name>
15-
<description>Demo project for Spring Boot</description>
14+
1615
<properties>
1716
<java.version>17</java.version>
1817
</properties>
@@ -32,6 +31,11 @@
3231
<artifactId>spring-boot-starter-test</artifactId>
3332
<scope>test</scope>
3433
</dependency>
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
37+
<scope>test</scope>
38+
</dependency>
3539
</dependencies>
3640

3741
<build>

complete/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'accessing-data-jpa'
1+
rootProject.name = 'accessing-data-jpa-complete'

complete/src/test/java/com/example/accessingdatajpa/CustomerRepositoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
import org.junit.jupiter.api.Test;
2424
import org.springframework.beans.factory.annotation.Autowired;
25-
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
26-
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
25+
import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest;
26+
import org.springframework.boot.jpa.test.autoconfigure.TestEntityManager;
2727

2828
@DataJpaTest
2929
public class CustomerRepositoryTests {

0 commit comments

Comments
 (0)