Skip to content

Commit 36a6da7

Browse files
committed
Upgrade to Spring Boot 4.0.0
1 parent 0277645 commit 36a6da7

File tree

11 files changed

+65
-58
lines changed

11 files changed

+65
-58
lines changed

README.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/
2020
[[scratch]]
2121
== Starting with Spring Initializr
2222

23-
If you like, you can use this https://start.spring.io/#!type=maven-project&language=java&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=graphqlserver&name=graphqlserver&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.graphqlserver[pre-populated Spring Initializr link] to load the correct settings.
23+
If you like, you can use this https://start.spring.io/#!type=gradle-project&language=java&platformVersion=4.0.0&packaging=jar&configurationFileFormat=properties&jvmVersion=17&groupId=com.example&artifactId=graphqlserver&name=graphqlserver&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.graphqlserver&dependencies=web,graphql[pre-populated Spring Initializr link] to load the correct settings.
2424
Otherwise, continue on to manually set up the Initializr.
2525

2626
To manually initialize the project:
@@ -282,8 +282,7 @@ GraphQL Java is the GraphQL engine powering Spring for GraphQL. Read the https:/
282282

283283
=== More Spring for GraphQL examples
284284

285-
See more samples in the
286-
https://github.com/spring-projects/spring-graphql/tree/1.0.x/samples[1.0.x branch], which will soon be https://github.com/spring-projects/spring-graphql/issues/208[moved into] a separate repository.
285+
See more samples in the https://github.com/spring-projects/spring-graphql-examples[dedicated repository].
287286

288287
=== Stack Overflow questions
289288
You can raise questions on https://stackoverflow.com/questions/tagged/spring-graphql[Stack Overflow with the spring-graphql] tag.

complete/build.gradle

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
plugins {
2-
id 'java'
3-
id 'org.springframework.boot' version '3.5.0'
2+
id 'java'
3+
id 'org.springframework.boot' version '4.0.0'
4+
id 'io.spring.dependency-management' version '1.1.7'
45
}
56

6-
apply plugin: 'io.spring.dependency-management'
7-
87
group = 'com.example'
98
version = '0.0.1-SNAPSHOT'
109

1110
java {
12-
sourceCompatibility = '17'
11+
toolchain {
12+
languageVersion = JavaLanguageVersion.of(17)
13+
}
1314
}
1415

1516
repositories {
1617
mavenCentral()
1718
}
1819

1920
dependencies {
20-
implementation 'org.springframework.boot:spring-boot-starter-graphql'
21-
implementation 'org.springframework.boot:spring-boot-starter-web'
22-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
23-
testImplementation 'org.springframework:spring-webflux'
24-
testImplementation 'org.springframework.graphql:spring-graphql-test'
21+
implementation 'org.springframework.boot:spring-boot-starter-graphql'
22+
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
23+
testImplementation 'org.springframework.boot:spring-boot-starter-graphql-test'
24+
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
25+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2526
}
2627

2728
tasks.named('test') {
-17.7 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

complete/gradlew

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,26 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
197198
done
198199
fi
199200

200-
# Collect all arguments for the java command;
201-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202-
# shell script including quotes and variable substitutions, so put them in
203-
# double quotes to make sure that they get re-expanded; and
204-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
205210

206211
set -- \
207212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

complete/src/test/java/com/example/graphqlserver/BookControllerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.beans.factory.annotation.Autowired;
5-
import org.springframework.boot.test.autoconfigure.graphql.GraphQlTest;
5+
import org.springframework.boot.graphql.test.autoconfigure.GraphQlTest;
66
import org.springframework.graphql.test.tester.GraphQlTester;
77

88
@GraphQlTest(BookController.class)

initial/build.gradle

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
plugins {
2-
id 'java'
3-
id 'org.springframework.boot' version '3.5.0'
2+
id 'java'
3+
id 'org.springframework.boot' version '4.0.0'
4+
id 'io.spring.dependency-management' version '1.1.7'
45
}
56

6-
apply plugin: 'io.spring.dependency-management'
7-
87
group = 'com.example'
98
version = '0.0.1-SNAPSHOT'
109

1110
java {
12-
sourceCompatibility = '17'
11+
toolchain {
12+
languageVersion = JavaLanguageVersion.of(17)
13+
}
1314
}
1415

1516
repositories {
1617
mavenCentral()
1718
}
1819

1920
dependencies {
20-
implementation 'org.springframework.boot:spring-boot-starter-graphql'
21-
implementation 'org.springframework.boot:spring-boot-starter-web'
22-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
23-
testImplementation 'org.springframework:spring-webflux'
24-
testImplementation 'org.springframework.graphql:spring-graphql-test'
21+
implementation 'org.springframework.boot:spring-boot-starter-graphql'
22+
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
23+
testImplementation 'org.springframework.boot:spring-boot-starter-graphql-test'
24+
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
25+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2526
}
2627

2728
tasks.named('test') {
2.12 KB
Binary file not shown.

initial/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.5-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

initial/gradlew

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87-
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
8890

8991
# Use the maximum available, or set MAX_FD != -1 to use that value.
9092
MAX_FD=maximum
@@ -112,7 +114,6 @@ case "$( uname )" in #(
112114
NONSTOP* ) nonstop=true ;;
113115
esac
114116

115-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116117

117118

118119
# Determine the Java command to use to start the JVM.
@@ -170,7 +171,6 @@ fi
170171
# For Cygwin or MSYS, switch paths to Windows format before running java
171172
if "$cygwin" || "$msys" ; then
172173
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173-
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174174

175175
JAVACMD=$( cygpath --unix "$JAVACMD" )
176176

@@ -203,15 +203,14 @@ fi
203203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204204

205205
# Collect all arguments for the java command:
206-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207207
# and any embedded shellness will be escaped.
208208
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209209
# treated as '${Hostname}' itself on the command line.
210210

211211
set -- \
212212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
213-
-classpath "$CLASSPATH" \
214-
org.gradle.wrapper.GradleWrapperMain \
213+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
215214
"$@"
216215

217216
# Stop when "xargs" is not available.

0 commit comments

Comments
 (0)